Auto merge of #3548 - Eirik0:3546-sapling-coin-priority, r=bitcartel
Use max priority for all shielded transactions Addresses https://github.com/zcash/zcash/issues/3546#issuecomment-425184034
This commit is contained in:
commit
bcdb4344f0
|
@ -53,9 +53,14 @@ class WalletSaplingTest(BitcoinTestFramework):
|
|||
recipients = []
|
||||
recipients.append({"address": saplingAddr0, "amount": Decimal('20')})
|
||||
myopid = self.nodes[0].z_sendmany(taddr0, recipients, 1, 0)
|
||||
wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
|
||||
self.sync_all()
|
||||
|
||||
# Verify priority of tx is MAX_PRIORITY, defined as 1E+16 (10000000000000000)
|
||||
mempool = self.nodes[0].getrawmempool(True)
|
||||
assert(Decimal(mempool[mytxid]['startingpriority']) == Decimal('1E+16'))
|
||||
|
||||
self.nodes[2].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
|
@ -70,9 +75,14 @@ class WalletSaplingTest(BitcoinTestFramework):
|
|||
recipients = []
|
||||
recipients.append({"address": saplingAddr1, "amount": Decimal('15')})
|
||||
myopid = self.nodes[0].z_sendmany(saplingAddr0, recipients, 1, 0)
|
||||
wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
mytxid = wait_and_assert_operationid_status(self.nodes[0], myopid)
|
||||
|
||||
self.sync_all()
|
||||
|
||||
# Verify priority of tx is MAX_PRIORITY, defined as 1E+16 (10000000000000000)
|
||||
mempool = self.nodes[0].getrawmempool(True)
|
||||
assert(Decimal(mempool[mytxid]['startingpriority']) == Decimal('1E+16'))
|
||||
|
||||
self.nodes[2].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
|
@ -92,6 +102,11 @@ class WalletSaplingTest(BitcoinTestFramework):
|
|||
mytxid = wait_and_assert_operationid_status(self.nodes[1], myopid)
|
||||
|
||||
self.sync_all()
|
||||
|
||||
# Verify priority of tx is MAX_PRIORITY, defined as 1E+16 (10000000000000000)
|
||||
mempool = self.nodes[1].getrawmempool(True)
|
||||
assert(Decimal(mempool[mytxid]['startingpriority']) == Decimal('1E+16'))
|
||||
|
||||
self.nodes[2].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
|
|
|
@ -616,16 +616,16 @@ double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const
|
|||
if (tx.IsCoinBase())
|
||||
return 0.0;
|
||||
|
||||
// Joinsplits do not reveal any information about the value or age of a note, so we
|
||||
// Shielded transfers do not reveal any information about the value or age of a note, so we
|
||||
// cannot apply the priority algorithm used for transparent utxos. Instead, we just
|
||||
// use the maximum priority whenever a transaction contains any JoinSplits.
|
||||
// (Note that coinbase transactions cannot contain JoinSplits.)
|
||||
// FIXME: this logic is partially duplicated between here and CreateNewBlock in miner.cpp.
|
||||
// use the maximum priority for all (partially or fully) shielded transactions.
|
||||
// (Note that coinbase transactions cannot contain JoinSplits, or Sapling shielded Spends or Outputs.)
|
||||
|
||||
if (tx.vjoinsplit.size() > 0) {
|
||||
if (tx.vjoinsplit.size() > 0 || tx.vShieldedSpend.size() > 0 || tx.vShieldedOutput.size() > 0) {
|
||||
return MAX_PRIORITY;
|
||||
}
|
||||
|
||||
// FIXME: this logic is partially duplicated between here and CreateNewBlock in miner.cpp.
|
||||
double dResult = 0.0;
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue