Parse transaction weights into blktxn_t structure
ABI break: sizeof(blktxn_t) has been increased, so accesses to blktmpl_t->txns[>0] use a different offset (aside, hash_ and txid are moved) New ABI supports up to 512 MB transactions (with a max weight-per-bytes of 4), and library gracefully interprets larger weight values as -1 (unknown)
This commit is contained in:
@@ -163,6 +163,15 @@ const char *parse_txn(struct blktxn_t *txn, json_t *txnj) {
|
||||
}
|
||||
}
|
||||
|
||||
txn->weight = -1;
|
||||
if ((vv = json_object_get(txnj, "weight")) && json_is_number(vv)) {
|
||||
const double f = json_number_value(txnj);
|
||||
const int32_t i32 = f;
|
||||
if (f == i32) {
|
||||
txn->weight = i32;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: dependcount/depends, fee, required, sigops
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -39,6 +39,7 @@ struct blktxn_t {
|
||||
uint64_t fee;
|
||||
bool required;
|
||||
int16_t sigops;
|
||||
int32_t weight;
|
||||
|
||||
txnhash_t *hash_;
|
||||
txnhash_t *txid;
|
||||
|
||||
Reference in New Issue
Block a user