Skip to content

Commit c5be710

Browse files
authored
Merge pull request #926 from cyberway/develop
Merge develop to master
2 parents a330398 + 049d4fe commit c5be710

File tree

4 files changed

+369
-19
lines changed

4 files changed

+369
-19
lines changed

golos.publication/golos.publication.abi

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,13 @@
935935
{"name": "rsharesfn", "type": "wide_t"}
936936
]
937937
},
938+
{
939+
"name": "pool_erase_event",
940+
"base": "",
941+
"fields": [
942+
{"name": "created", "type": "uint64"}
943+
]
944+
},
938945
{
939946
"name": "reward_weight_event",
940947
"base": "",
@@ -957,7 +964,7 @@
957964
],
958965
"events": [
959966
{"name": "poolstate", "type": "pool_event"},
960-
{"name": "poolerase", "type": "uint64"},
967+
{"name": "poolerase", "type": "pool_erase_event"},
961968
{"name": "poststate", "type": "post_event"},
962969
{"name": "votestate", "type": "vote_event"},
963970
{"name": "rewardweight", "type": "reward_weight_event"},

golos.publication/golos.publication.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,8 @@ void publication::syncpool(std::optional<symbol> tokensymbol) {
13511351
auto date_of_oldest_mssg = last_pool->created;
13521352
tables::message_table message_table(_self, _self.value);
13531353
auto oldest_mssg_itr = message_table.begin();
1354-
if (oldest_mssg_itr != message_table.end() && oldest_mssg_itr->date < date_of_oldest_mssg) {
1355-
date_of_oldest_mssg = oldest_mssg_itr->date;
1354+
if (oldest_mssg_itr != message_table.end() && oldest_mssg_itr->pool_date < date_of_oldest_mssg) {
1355+
date_of_oldest_mssg = oldest_mssg_itr->pool_date;
13561356
}
13571357
auto pool = pools.begin();
13581358
while (pool->created < date_of_oldest_mssg) {

scripts/testnet.py

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _cleos(arguments, *, output=True):
3535
except subprocess.CalledProcessError as e:
3636
import sys
3737
(exception, traceback) = (e, sys.exc_info()[2])
38-
38+
3939
msg = str(exception) + ' with output:\n' + exception.output
4040
raise Exception(msg).with_traceback(traceback)
4141

@@ -47,7 +47,7 @@ def cleos(arguments, *, keys=None):
4747
return _cleos("push transaction -j --skip-sign '%s'" % trx, output=False)
4848
else:
4949
return _cleos(arguments)
50-
50+
5151

5252
def pushAction(code, action, actor, args, *, additional='', delay=None, expiration=None, providebw=None, keys=None):
5353
additional += ' --delay-sec %d' % delay if delay else ''
@@ -76,6 +76,38 @@ def removeRootKeys():
7676
def unlockWallet():
7777
cleos('wallet unlock --password %s' % args.wallet_password)
7878

79+
def parseAuthority(auth):
80+
if type(auth) == type([]):
81+
return [parseAuthority(a) for a in auth]
82+
d = auth.split('@',2)
83+
if len(d) == 1:
84+
d.extend(['active'])
85+
return {'actor':d[0], 'permission':d[1]}
86+
87+
def createAction(contract, action, actors, args):
88+
data = cleos("convert pack_action_data {contract} {action} {args}".format(
89+
contract=contract, action=action, args=jsonArg(args))).rstrip()
90+
return {
91+
'account':contract,
92+
'name':action,
93+
'authorization':parseAuthority(actors if type(actors)==type([]) else [actors]),
94+
'data':data
95+
}
96+
97+
class Trx:
98+
def __init__(self, expiration=None):
99+
additional = '--skip-sign --dont-broadcast'
100+
if expiration:
101+
additional += ' --expiration {exp}'.format(exp=expiration)
102+
self.trx = pushAction('cyber', 'checkwin', 'cyber', {}, additional=additional)
103+
self.trx['actions'] = []
104+
105+
def addAction(self, contract, action, actors, args):
106+
self.trx['actions'].append(createAction(contract, action, actors, args))
107+
108+
def getTrx(self):
109+
return self.trx
110+
79111
# --------------------- EOSIO functions ---------------------------------------
80112

81113
def createAuthority(keys, accounts):
@@ -162,9 +194,19 @@ def createPost(author, permlink, category, header, body, *, beneficiaries=[], pr
162194
'jsonmetadata':''
163195
}, providebw=providebw, keys=keys)
164196

165-
def createComment(author, permlink, pauthor, ppermlink, header, body, *, beneficiaries=[]):
166-
return pushAction('gls.publish', 'createmssg', author,
167-
[author, permlink, pauthor, ppermlink, beneficiaries, 0, False, header, body, 'ru', [], ''])
197+
def createComment(author, permlink, pauthor, ppermlink, header, body, *, beneficiaries=[], providebw=None, keys=None):
198+
return pushAction('gls.publish', 'createmssg', author, {
199+
'message_id':{'author':author, 'permlink':permlink},
200+
'parent_id':{'author':pauthor, 'permlink':ppermlink},
201+
'beneficiaries':beneficiaries,
202+
'tokenprop':0,
203+
'vestpayment':False,
204+
'headermssg':header,
205+
'bodymssg':body,
206+
'languagemssg':'ru',
207+
'tags':[],
208+
'jsonmetadata':''
209+
}, providebw=providebw, keys=keys)
168210

169211
def upvotePost(voter, author, permlink, weight, *, providebw=None, keys=None):
170212
return pushAction('gls.publish', 'upvote', voter, {'voter':voter, 'message_id':{'author':author, 'permlink':permlink}, 'weight':weight}, providebw=providebw, keys=keys)

0 commit comments

Comments
 (0)