每天进步一点点:transfer_to_vesting / Power UP

每天进步一点点:transfer_to_vesting / Power UP

昨天在测试memo的时候,放了几段长长的古文,比如《得道多助,失道寡助》之类的,结果用力过猛,@oflyhigh.test RC不够用了。


(图源 :pixabay)

RC告急

看着这段提示就很闹心,何况还要等很久等RC恢复,这我不能忍受😳

‘plugin exception:Account: oflyhigh.test has 436004956 RC, needs 535083479 ‘
‘RC. Please wait to transact, or power up HIVE.rethrow’

大家都知道RC和HP相关,HP越多,可用RC越多,恢复起来也越快,既然RC不够了,还要继续测试memo,那么只好Power UP了,于是用cli_wallet 的transfer_to_vesting功能给@oflyhigh.test Power UP了一些HP,总算可以继续愉快地测试了。

image.png

不过等忙完memo的事,我不禁想,自己在写程序,然后还要用cli_wallet来搞定Power UP,这多嘲讽啊,应该直接搞一个Power UP的功能嘛。

Power UP 功能

其实Power UP的功能很好搞,首先定义如下operation:

1
2
3
4
5
op_transfer_to_vesting = ['transfer_to_vesting',{
'from': '',
'to':'',
'amount':''
}]

然后写类似如下的代码:

op[1]['from'] = from_account
op[1]['to'] = to_account
op[1]['amount'] = HIVE_ASSET(asset)

trx.append_op(op)
trx.sign_digest(wif)
trx.broadcast()

将其中的asset设置为1.000 HIVE并广播,广播出去的transaction类似如下:

image.png

https://hiveblocks.com/ 上查看,可见Power UP已经成功了:

image.png

其它测试

虽然明知道Power UP HBD是不可以的,还是忍不住用1.000 HBD测试了一下:

‘Assert Exception:amount.symbol == STEEM_SYMBOL || ( amount.symbol.space() == ‘
‘asset_symbol_type::smt_nai_space && amount.symbol.is_vesting() == false ): ‘
‘Amount must be HIVE or SMT liquid’

注意到这个内容了吗?Amount must be HIVE or SMT liquid,好熟悉既陌生的SMT字样,也不知道SMT何时能上线啊?

不感慨SMT的事情了,总之transfer_to_vesting / Power UP功能搞定了,以后可以愉快地用自己的工具Power UP啦。


This page is synchronized from the post: ‘每天进步一点点:transfer_to_vesting / Power UP’

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×