Skip to content

Commit

Permalink
Auto merge of zcash#1718 - ebfull:valid-fee-selection, r=nathan-at-least
Browse files Browse the repository at this point in the history
Properly account for JoinSplit value when deciding if a transaction should be placed in a mined block.

Closes zcash#1705.

The transaction selection logic in miner.cpp was not updated to account for JoinSplit value. This caused issues that include, but are not limited to, miners not including pure JoinSplit transactions in their blocks.
  • Loading branch information
zkbot committed Nov 3, 2016
2 parents 51a5737 + 5267695 commit 9eb852e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qa/rpc-tests/zcjoinsplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ def run_test(self):
receive_result = self.nodes[0].zcrawreceive(zcsecretkey, joinsplit_result["encryptednote1"])
assert_equal(receive_result["exists"], True)

# The pure joinsplit we create should be mined in the next block
# despite other transactions being in the mempool.
addrtest = self.nodes[0].getnewaddress()
for xx in range(0,10):
self.nodes[0].generate(1)
for x in range(0,50):
self.nodes[0].sendtoaddress(addrtest, 0.01);

joinsplit_tx = self.nodes[0].createrawtransaction([], {})
joinsplit_result = self.nodes[0].zcrawjoinsplit(joinsplit_tx, {receive_result["note"] : zcsecretkey}, {zcaddress: 39.8}, 0, 0.1)

Expand Down
2 changes: 2 additions & 0 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)

dPriority += (double)nValueIn * nConf;
}
nTotalIn += tx.GetJoinSplitValueIn();

if (fMissingInputs) continue;

// Priority is sum(valuein * age) / modified_txsize
Expand Down

0 comments on commit 9eb852e

Please sign in to comment.