Unverified Commit 233bd4d3 authored by vipwzw's avatar vipwzw Committed by GitHub

Merge pull request #780 from lyh169/autonomy_rpc_test

Autonomy rpc test
parents 754b2b90 d22327c7
......@@ -2,6 +2,7 @@
RAW_TX_HASH=""
LAST_BLOCK_HASH=""
LAST_BLOCK_HEIGHT=0
CASE_ERR=""
RETURN_RESP=""
......@@ -191,6 +192,13 @@ chain33_LastBlockhash() {
echo -e "######\\n last blockhash is $LAST_BLOCK_HASH \\n######"
}
chain33_LastBlockHeight() {
local MAIN_HTTP=$1
result=$(curl -ksd '{"method":"Chain33.GetLastHeader","params":[{}]}' -H 'content-type:text/plain;' "${MAIN_HTTP}" | jq -r ".result.height")
LAST_BLOCK_HEIGHT=$result
echo -e "######\\n last blockheight is $LAST_BLOCK_HEIGHT \\n######"
}
chain33_applyCoins() {
echo "chain33_getMainChainCoins"
if [ "$#" -lt 3 ]; then
......
......@@ -112,6 +112,9 @@ function base_init() {
#relay genesis
sed -i $sedfix 's/^genesis="12qyocayNF7.*/genesis="1G5Cjy8LuQex2fuYv3gzb7B8MxAnxLEqt3"/g' chain33.toml
#autonomy
sed -i $sedfix 's/^useBalance=.*/useBalance=true/g' chain33.toml
sed -i $sedfix 's/^total="16htvcBNS.*/total="1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx"/g' chain33.toml
}
function start() {
......@@ -433,6 +436,15 @@ function dapp_test_address() {
# block_wait "${1}" 1
tx_wait "${1}" "${hash}"
#autonomy allocation for rpc test 1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx
result=$(${1} account import_key -k 1c3e6cac2f887e1ab9180e2d5772dc4ba01accb8d4df434faba097003eb35482 -l autonomytest | jq ".label")
echo "${result}"
if [ -z "${result}" ]; then
exit 1
fi
hash=$(${1} send coins transfer -a 6300 -n transfer -t 1Q9sQwothzM1gKSzkVZ8Dt1tqKX1uzSagx -k 4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01)
echo "${hash}"
}
function base_config() {
......
This diff is collapsed.
......@@ -22,6 +22,7 @@ var (
driverName = auty.AutonomyX
autonomyAddr string
subcfg subConfig
ticketName = auty.TicketX
)
// Init 重命名执行器名称
......@@ -30,6 +31,7 @@ func Init(name string, cfg *types.Chain33Config, sub []byte) {
types.MustDecode(sub, &subcfg)
}
autonomyAddr = address.ExecAddress(cfg.ExecName(auty.AutonomyX))
ticketName = cfg.ExecName(auty.TicketX)
drivers.Register(cfg, GetName(), newAutonomy, cfg.GetDappFork(driverName, "Enable"))
InitExecType()
}
......
......@@ -457,7 +457,7 @@ func (a *action) batchGetAddressVotes(addrs []string, height int64) (int32, erro
}
func (a *action) getAddressVotes(addr string, height int64) (int32, error) {
account, err := a.getStartHeightVoteAccount(addr, auty.TicketX, height)
account, err := a.getStartHeightVoteAccount(addr, ticketName, height)
if err != nil {
return 0, err
}
......
......@@ -61,7 +61,9 @@ function para_set_toml() {
"1GCzJDS6HbgTQ2emade7mEJGGWFfA15pS9",\
"1JYB8sxi4He5pZWHCd3Zi2nypQ4JMB6AxN",\
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv",]/g' "${1}"
#autonomy
sed -i $xsedfix 's/^useBalance=.*/useBalance=true/g' "${1}"
sed -i $xsedfix 's/^total="16htvcBNS.*/total="1EZrEKPPC36SLRoLQBwLDjzcheiLRZJg49"/g' "${1}"
}
function para_set_wallet() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment