Reduce recommended fees
* Reduce DEFAULT_FALLBACK_FEE to 1,000,000 Koinu. Note this by itself has no effect as the required fee is higher. * Reduce wallet minimum fees to 0.01 DOGE * Update DEFAULT_DUST_LIMIT * Revise derived values after updating recommended fees * Remove fee rounding from RPC tests * Revert tests back to Bitcoin originals where possible
This commit is contained in:
parent
97190c0ae6
commit
9c6af6d841
|
@ -16,7 +16,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=1"]))
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug","-logtimemicros"]))
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
|
@ -32,7 +32,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
|
||||
sync_blocks(self.nodes)
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(balance - newbalance <= Decimal("3")) #no more than fees lost
|
||||
assert(balance - newbalance < Decimal("0.01")) #no more than fees lost
|
||||
balance = newbalance
|
||||
|
||||
url = urllib.parse.urlparse(self.nodes[1].url)
|
||||
|
@ -49,33 +49,33 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
inputs.append({"txid":txB, "vout":nB})
|
||||
outputs = {}
|
||||
|
||||
outputs[self.nodes[0].getnewaddress()] = Decimal("14")
|
||||
outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998")
|
||||
outputs[self.nodes[1].getnewaddress()] = Decimal("5")
|
||||
signed = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
|
||||
|
||||
# Identify the 14.99998btc output
|
||||
nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14"))
|
||||
nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.99998"))
|
||||
|
||||
#Create a child tx spending AB1 and C
|
||||
inputs = []
|
||||
inputs.append({"txid":txAB1, "vout":nAB})
|
||||
inputs.append({"txid":txC, "vout":nC})
|
||||
outputs = {}
|
||||
outputs[self.nodes[0].getnewaddress()] = Decimal("23")
|
||||
outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996")
|
||||
signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||
|
||||
# In mempool txs from self should increase balance from change
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert_equal(newbalance, balance - Decimal("30") + Decimal("23"))
|
||||
assert_equal(newbalance, balance - Decimal("30") + Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
|
||||
# TODO: redo with eviction
|
||||
# Note had to make sure tx did not have AllowFree priority
|
||||
stop_node(self.nodes[0],0)
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=5"])
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
|
||||
|
||||
# Verify txs no longer in mempool
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||
|
@ -83,7 +83,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
# Not in mempool txs from self should only reduce balance
|
||||
# inputs are still spent, but change not received
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert_equal(newbalance, balance - Decimal("23"))
|
||||
assert_equal(newbalance, balance - Decimal("24.9996"))
|
||||
# Unconfirmed received funds that are not in mempool, also shouldn't show
|
||||
# up in unconfirmed balance
|
||||
unconfbalance = self.nodes[0].getunconfirmedbalance() + self.nodes[0].getbalance()
|
||||
|
@ -101,7 +101,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
|
||||
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
||||
stop_node(self.nodes[0],0)
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=1"])
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"])
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||
assert_equal(self.nodes[0].getbalance(), balance)
|
||||
|
||||
|
@ -110,21 +110,21 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
# But its child tx remains abandoned
|
||||
self.nodes[0].sendrawtransaction(signed["hex"])
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert_equal(newbalance, balance - Decimal("20") + Decimal("14"))
|
||||
assert_equal(newbalance, balance - Decimal("20") + Decimal("14.99998"))
|
||||
balance = newbalance
|
||||
|
||||
# Send child tx again so its unabandoned
|
||||
self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert_equal(newbalance, balance - Decimal("10") - Decimal("14") + Decimal("23"))
|
||||
assert_equal(newbalance, balance - Decimal("10") - Decimal("14.99998") + Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Remove using high relay fee again
|
||||
stop_node(self.nodes[0],0)
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=5"])
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert_equal(newbalance, balance - Decimal("23"))
|
||||
assert_equal(newbalance, balance - Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Create a double spend of AB1 by spending again from only A's 10 output
|
||||
|
@ -132,7 +132,7 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||
inputs =[]
|
||||
inputs.append({"txid":txA, "vout":nA})
|
||||
outputs = {}
|
||||
outputs[self.nodes[1].getnewaddress()] = Decimal("9")
|
||||
outputs[self.nodes[1].getnewaddress()] = Decimal("9.999")
|
||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
signed = self.nodes[0].signrawtransaction(tx)
|
||||
self.nodes[1].sendrawtransaction(signed["hex"])
|
||||
|
|
|
@ -209,7 +209,7 @@ def test_settxfee(rbf_node, dest_address):
|
|||
def test_rebumping(rbf_node, dest_address):
|
||||
# check that re-bumping the original tx fails, but bumping the bumper succeeds
|
||||
rbf_node.settxfee(Decimal("10.00000000"))
|
||||
rbfid = create_fund_sign_send(rbf_node, {dest_address: 7.00000000})
|
||||
rbfid = create_fund_sign_send(rbf_node, {dest_address: 8.00000000})
|
||||
bumped = rbf_node.bumpfee(rbfid, {"totalFee": 1050000000})
|
||||
assert_raises_jsonrpc(-4, "already bumped", rbf_node.bumpfee, rbfid, {"totalFee": 11000})
|
||||
rbf_node.bumpfee(bumped["txid"], {"totalFee": 1100000000})
|
||||
|
|
|
@ -59,9 +59,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
rawmatch = self.nodes[2].fundrawtransaction(rawmatch, {"changePosition":1, "subtractFeeFromOutputs":[0]})
|
||||
assert_equal(rawmatch["changepos"], -1)
|
||||
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 15)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 10)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 50)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0)
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
@ -82,7 +82,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
# simple test with two coins #
|
||||
##############################
|
||||
inputs = [ ]
|
||||
outputs = { self.nodes[0].getnewaddress() : 22 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 2.2 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
|
||||
|
@ -95,7 +95,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
# simple test with two coins #
|
||||
##############################
|
||||
inputs = [ ]
|
||||
outputs = { self.nodes[0].getnewaddress() : 26 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 2.6 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
|
||||
|
@ -110,7 +110,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
# simple test with two outputs #
|
||||
################################
|
||||
inputs = [ ]
|
||||
outputs = { self.nodes[0].getnewaddress() : 26, self.nodes[1].getnewaddress() : 25 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 2.6, self.nodes[1].getnewaddress() : 2.5 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
|
||||
|
@ -128,10 +128,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
#########################################################################
|
||||
# test a fundrawtransaction with a VIN greater than the required amount #
|
||||
#########################################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}]
|
||||
outputs = { self.nodes[0].getnewaddress() : 10 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 1.0 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -149,11 +149,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
#####################################################################
|
||||
# test a fundrawtransaction with which will not get a change output #
|
||||
#####################################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}]
|
||||
# Dogecoin: Fee is exact, do not use tolerance
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(50) - fee }
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(5.0) - fee - feeTolerance }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -172,10 +171,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
####################################################
|
||||
# test a fundrawtransaction with an invalid option #
|
||||
####################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ]
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(40) }
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(4.0) }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -185,10 +184,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
############################################################
|
||||
# test a fundrawtransaction with an invalid change address #
|
||||
############################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ]
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(40) }
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(4.0) }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -198,11 +197,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
############################################################
|
||||
# test a fundrawtransaction with a provided change address #
|
||||
############################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ]
|
||||
# Dogecoin: Reduce this output so the fee doesn't leave us with no change
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(25) }
|
||||
outputs = { self.nodes[0].getnewaddress() : Decimal(4.0) }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -218,10 +216,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
#########################################################################
|
||||
# test a fundrawtransaction with a VIN smaller than the required amount #
|
||||
#########################################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 10)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 1)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}]
|
||||
outputs = { self.nodes[0].getnewaddress() : 10 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 1.0 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
|
||||
# 4-byte version + 1-byte vin count + 36-byte prevout then script_len
|
||||
|
@ -253,11 +251,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
###########################################
|
||||
# test a fundrawtransaction with two VINs #
|
||||
###########################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 10)
|
||||
utx2 = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 1)
|
||||
utx2 = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']},{'txid' : utx2['txid'], 'vout' : utx2['vout']} ]
|
||||
outputs = { self.nodes[0].getnewaddress() : 60 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 6.0 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -286,11 +284,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
#########################################################
|
||||
# test a fundrawtransaction with two VINs and two vOUTs #
|
||||
#########################################################
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 10)
|
||||
utx2 = get_unspent(self.nodes[2].listunspent(), 50)
|
||||
utx = get_unspent(self.nodes[2].listunspent(), 1)
|
||||
utx2 = get_unspent(self.nodes[2].listunspent(), 5)
|
||||
|
||||
inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']},{'txid' : utx2['txid'], 'vout' : utx2['vout']} ]
|
||||
outputs = { self.nodes[0].getnewaddress() : 60, self.nodes[0].getnewaddress() : 10 }
|
||||
outputs = { self.nodes[0].getnewaddress() : 6.0, self.nodes[0].getnewaddress() : 1.0 }
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
|
||||
|
@ -313,7 +311,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
##############################################
|
||||
listunspent = self.nodes[2].listunspent()
|
||||
inputs = [ {'txid' : "1c7f966dab21119bac53213a2bc7532bff1fa844c124fd750a7d0b1332440bd1", 'vout' : 0} ] #invalid vin!
|
||||
outputs = { self.nodes[0].getnewaddress() : 10}
|
||||
outputs = { self.nodes[0].getnewaddress() : 1.0}
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
|
||||
|
||||
|
@ -322,12 +320,12 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
############################################################
|
||||
#compare fee of a standard pubkeyhash transaction
|
||||
inputs = []
|
||||
outputs = {self.nodes[1].getnewaddress():11}
|
||||
outputs = {self.nodes[1].getnewaddress():1.1}
|
||||
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 11)
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1.1)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
|
@ -338,7 +336,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
############################################################
|
||||
#compare fee of a standard pubkeyhash transaction with multiple outputs
|
||||
inputs = []
|
||||
outputs = {self.nodes[1].getnewaddress():110,self.nodes[1].getnewaddress():120,self.nodes[1].getnewaddress():10,self.nodes[1].getnewaddress():130,self.nodes[1].getnewaddress():20,self.nodes[1].getnewaddress():30}
|
||||
outputs = {self.nodes[1].getnewaddress():1.1,self.nodes[1].getnewaddress():1.2,self.nodes[1].getnewaddress():0.1,self.nodes[1].getnewaddress():1.3,self.nodes[1].getnewaddress():0.2,self.nodes[1].getnewaddress():0.3}
|
||||
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
#create same transaction over sendtoaddress
|
||||
|
@ -369,7 +367,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 11)
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
|
@ -402,7 +400,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 11)
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
|
@ -425,14 +423,14 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
|
||||
|
||||
# send 1.2 BTC to msig addr
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 12)
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2)
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
oldBalance = self.nodes[1].getbalance()
|
||||
inputs = []
|
||||
outputs = {self.nodes[1].getnewaddress():11}
|
||||
outputs = {self.nodes[1].getnewaddress():1.1}
|
||||
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[2].fundrawtransaction(rawTx)
|
||||
|
||||
|
@ -443,7 +441,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.sync_all()
|
||||
|
||||
# make sure funds are received at node1
|
||||
assert_equal(oldBalance+Decimal('11.0000000'), self.nodes[1].getbalance())
|
||||
assert_equal(oldBalance+Decimal('1.10000000'), self.nodes[1].getbalance())
|
||||
|
||||
############################################################
|
||||
# locked wallet test
|
||||
|
@ -469,7 +467,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
# drain the keypool
|
||||
self.nodes[1].getnewaddress()
|
||||
inputs = []
|
||||
outputs = {self.nodes[0].getnewaddress():11}
|
||||
outputs = {self.nodes[0].getnewaddress():1.1}
|
||||
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||
# fund a transaction that requires a new key for the change output
|
||||
# creating the key must be impossible because the wallet is locked
|
||||
|
@ -479,12 +477,12 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.nodes[1].walletpassphrase("test", 100)
|
||||
self.nodes[1].walletlock()
|
||||
|
||||
assert_raises_jsonrpc(-13, "walletpassphrase", self.nodes[1].sendtoaddress, self.nodes[0].getnewaddress(), 12)
|
||||
assert_raises_jsonrpc(-13, "walletpassphrase", self.nodes[1].sendtoaddress, self.nodes[0].getnewaddress(), 1.2)
|
||||
|
||||
oldBalance = self.nodes[0].getbalance()
|
||||
|
||||
inputs = []
|
||||
outputs = {self.nodes[0].getnewaddress():11}
|
||||
outputs = {self.nodes[0].getnewaddress():1.1}
|
||||
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[1].fundrawtransaction(rawTx)
|
||||
|
||||
|
@ -496,7 +494,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.sync_all()
|
||||
|
||||
# make sure funds are received at node1
|
||||
assert_equal(oldBalance+Decimal('500011.00000000'), self.nodes[0].getbalance())
|
||||
assert_equal(oldBalance+Decimal('500001.10000000'), self.nodes[0].getbalance())
|
||||
|
||||
|
||||
###############################################
|
||||
|
@ -510,14 +508,13 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.sync_all()
|
||||
|
||||
for i in range(0,20):
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 20)
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
#fund a tx with ~20 small inputs
|
||||
inputs = []
|
||||
# Dogecoin: TX size rounding gives us a fee of 1 DOGE. 20 - 15 - 1 = 4 DOGE change
|
||||
outputs = {self.nodes[0].getnewaddress():15,self.nodes[0].getnewaddress():4}
|
||||
outputs = {self.nodes[0].getnewaddress():0.15,self.nodes[0].getnewaddress():0.04}
|
||||
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[1].fundrawtransaction(rawTx)
|
||||
|
||||
|
@ -541,7 +538,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.sync_all()
|
||||
|
||||
for i in range(0,20):
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 2)
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
|
@ -549,7 +546,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
oldBalance = self.nodes[0].getbalance()
|
||||
|
||||
inputs = []
|
||||
outputs = {self.nodes[0].getnewaddress():15,self.nodes[0].getnewaddress():4}
|
||||
outputs = {self.nodes[0].getnewaddress():0.15,self.nodes[0].getnewaddress():0.04}
|
||||
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[1].fundrawtransaction(rawTx)
|
||||
fundedAndSignedTx = self.nodes[1].signrawtransaction(fundedTx['hex'])
|
||||
|
@ -557,7 +554,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
assert_equal(oldBalance+Decimal('500019.00000000'), self.nodes[0].getbalance()) #19+block reward
|
||||
assert_equal(oldBalance+Decimal('500000.19000'), self.nodes[0].getbalance()) #0.19+block reward
|
||||
|
||||
#####################################################
|
||||
# test fundrawtransaction with OP_RETURN and no vin #
|
||||
|
@ -582,7 +579,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
|
||||
watchonly_address = self.nodes[0].getnewaddress()
|
||||
watchonly_pubkey = self.nodes[0].validateaddress(watchonly_address)["pubkey"]
|
||||
watchonly_amount = Decimal(2000)
|
||||
watchonly_amount = Decimal(200)
|
||||
self.nodes[3].importpubkey(watchonly_pubkey, "", True)
|
||||
watchonly_txid = self.nodes[0].sendtoaddress(watchonly_address, watchonly_amount)
|
||||
self.nodes[0].sendtoaddress(self.nodes[3].getnewaddress(), watchonly_amount / 10)
|
||||
|
@ -639,11 +636,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
outputs = {self.nodes[3].getnewaddress() : 1}
|
||||
rawtx = self.nodes[3].createrawtransaction(inputs, outputs)
|
||||
result = self.nodes[3].fundrawtransaction(rawtx) # uses min_relay_tx_fee (set by settxfee)
|
||||
# TODO: We massively scale up min_relay_tx_fee here as it's not the recommended fee in 1.14.4,
|
||||
# but must be scaled back for 1.14.5
|
||||
result2 = self.nodes[3].fundrawtransaction(rawtx, {"feeRate": 2000*min_relay_tx_fee})
|
||||
result3 = self.nodes[3].fundrawtransaction(rawtx, {"feeRate": 10000*min_relay_tx_fee})
|
||||
result_fee_rate = result['fee'] * 1000 / round_tx_size(count_bytes(result['hex']))
|
||||
# Note TX fees in 1.14.5 are 10x the required minimum
|
||||
result2 = self.nodes[3].fundrawtransaction(rawtx, {"feeRate": 2*10*min_relay_tx_fee})
|
||||
result3 = self.nodes[3].fundrawtransaction(rawtx, {"feeRate": 10*10*min_relay_tx_fee})
|
||||
result_fee_rate = result['fee'] * 1000 / count_bytes(result['hex'])
|
||||
assert_fee_amount(result2['fee'], count_bytes(result2['hex']), 2 * result_fee_rate)
|
||||
assert_fee_amount(result3['fee'], count_bytes(result3['hex']), 10 * result_fee_rate)
|
||||
|
||||
|
@ -681,7 +677,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
assert_equal(len(self.nodes[3].listunspent(1)), 1)
|
||||
|
||||
inputs = []
|
||||
outputs = {self.nodes[2].getnewaddress(): 10}
|
||||
outputs = {self.nodes[2].getnewaddress(): 1}
|
||||
rawtx = self.nodes[3].createrawtransaction(inputs, outputs)
|
||||
|
||||
result = [self.nodes[3].fundrawtransaction(rawtx), # uses min_relay_tx_fee (set by settxfee)
|
||||
|
@ -704,7 +700,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
assert_equal(change[3] + result[3]['fee'], change[4])
|
||||
|
||||
inputs = []
|
||||
outputs = {self.nodes[2].getnewaddress(): value for value in (10, 11, 12, 13)}
|
||||
outputs = {self.nodes[2].getnewaddress(): value for value in (1.0, 1.1, 1.2, 1.3)}
|
||||
keys = list(outputs.keys())
|
||||
rawtx = self.nodes[3].createrawtransaction(inputs, outputs)
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
|||
self.nodes[0].generate(101)
|
||||
|
||||
self.sync_all()
|
||||
|
||||
|
||||
# address
|
||||
address1 = self.nodes[0].getnewaddress()
|
||||
# pubkey
|
||||
|
@ -58,21 +58,20 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
|||
assert_equal(address_info['ismine'], False)
|
||||
|
||||
#Send funds to self
|
||||
txnid3 = self.nodes[0].sendtoaddress(address3, 2.5)
|
||||
self.nodes[0].generate(1)
|
||||
rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex']
|
||||
proof3 = self.nodes[0].gettxoutproof([txnid3])
|
||||
|
||||
txnid2 = self.nodes[0].sendtoaddress(address2, 5)
|
||||
self.nodes[0].generate(1)
|
||||
rawtxn2 = self.nodes[0].gettransaction(txnid2)['hex']
|
||||
proof2 = self.nodes[0].gettxoutproof([txnid2])
|
||||
|
||||
txnid1 = self.nodes[0].sendtoaddress(address1, 10)
|
||||
txnid1 = self.nodes[0].sendtoaddress(address1, 0.1)
|
||||
self.nodes[0].generate(1)
|
||||
rawtxn1 = self.nodes[0].gettransaction(txnid1)['hex']
|
||||
proof1 = self.nodes[0].gettxoutproof([txnid1])
|
||||
|
||||
txnid2 = self.nodes[0].sendtoaddress(address2, 0.05)
|
||||
self.nodes[0].generate(1)
|
||||
rawtxn2 = self.nodes[0].gettransaction(txnid2)['hex']
|
||||
proof2 = self.nodes[0].gettxoutproof([txnid2])
|
||||
|
||||
txnid3 = self.nodes[0].sendtoaddress(address3, 0.025)
|
||||
self.nodes[0].generate(1)
|
||||
rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex']
|
||||
proof3 = self.nodes[0].gettxoutproof([txnid3])
|
||||
|
||||
self.sync_all()
|
||||
|
||||
|
@ -86,15 +85,15 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
|||
self.nodes[1].importaddress(address2, "add2", False)
|
||||
result2 = self.nodes[1].importprunedfunds(rawtxn2, proof2)
|
||||
balance2 = self.nodes[1].getbalance("add2", 0, True)
|
||||
assert_equal(balance2, Decimal('5'))
|
||||
assert_equal(balance2, Decimal('0.05'))
|
||||
|
||||
#Import with private key with no rescan
|
||||
self.nodes[1].importprivkey(address3_privkey, "add3", False)
|
||||
result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3)
|
||||
balance3 = self.nodes[1].getbalance("add3", 0, False)
|
||||
assert_equal(balance3, Decimal('2.5'))
|
||||
assert_equal(balance3, Decimal('0.025'))
|
||||
balance3 = self.nodes[1].getbalance("*", 0, True)
|
||||
assert_equal(balance3, Decimal('7.5'))
|
||||
assert_equal(balance3, Decimal('0.075'))
|
||||
|
||||
#Addresses Test - after import
|
||||
address_info = self.nodes[1].validateaddress(address1)
|
||||
|
@ -111,11 +110,11 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
|||
assert_raises_jsonrpc(-8, "Transaction does not exist in wallet.", self.nodes[1].removeprunedfunds, txnid1)
|
||||
|
||||
balance1 = self.nodes[1].getbalance("*", 0, True)
|
||||
assert_equal(balance1, Decimal('7.5'))
|
||||
assert_equal(balance1, Decimal('0.075'))
|
||||
|
||||
self.nodes[1].removeprunedfunds(txnid2)
|
||||
balance2 = self.nodes[1].getbalance("*", 0, True)
|
||||
assert_equal(balance2, Decimal('2.5'))
|
||||
assert_equal(balance2, Decimal('0.025'))
|
||||
|
||||
self.nodes[1].removeprunedfunds(txnid3)
|
||||
balance3 = self.nodes[1].getbalance("*", 0, True)
|
||||
|
|
|
@ -64,9 +64,9 @@ class PayTxFeeTest(BitcoinTestFramework):
|
|||
tx2 = self.nodes[0].getrawtransaction(txid2, True)
|
||||
tx3 = self.nodes[0].getrawtransaction(txid3, True)
|
||||
|
||||
assert_equal(tx1['vout'][0]['value'] + tx1['vout'][1]['value'], Decimal("999.9"))
|
||||
assert_equal(tx2['vout'][0]['value'] + tx2['vout'][1]['value'], Decimal("999"))
|
||||
assert_equal(tx3['vout'][0]['value'] + tx3['vout'][1]['value'], Decimal("999.9"))
|
||||
assert_equal(tx1['vout'][0]['value'] + tx1['vout'][1]['value'], Decimal("999.9774"))
|
||||
assert_equal(tx2['vout'][0]['value'] + tx2['vout'][1]['value'], Decimal("999.774"))
|
||||
assert_equal(tx3['vout'][0]['value'] + tx3['vout'][1]['value'], Decimal("999.9774"))
|
||||
|
||||
# mine a block
|
||||
self.nodes[0].generate(1);
|
||||
|
@ -76,7 +76,7 @@ class PayTxFeeTest(BitcoinTestFramework):
|
|||
block = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
|
||||
coinbaseTx = self.nodes[0].getrawtransaction(block['tx'][0], True)
|
||||
|
||||
assert_equal(coinbaseTx['vout'][0]['value'], Decimal("500001.2"))
|
||||
assert_equal(coinbaseTx['vout'][0]['value'], Decimal("500000.2712"))
|
||||
|
||||
if __name__ == '__main__':
|
||||
PayTxFeeTest().main()
|
||||
|
|
|
@ -33,7 +33,8 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
|
|||
def run_test(self):
|
||||
utxo_count = 90
|
||||
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], utxo_count)
|
||||
base_fee = self.relayfee*100 * 1000 # our transactions are smaller than 100kb
|
||||
# Note Dogecoin Core 1.14.5 wallet fee is 10x relay fee
|
||||
base_fee = self.relayfee*100 * 10# our transactions are smaller than 100kb
|
||||
txids = []
|
||||
|
||||
# Create 3 batches of transactions at 3 different fee rate levels
|
||||
|
|
|
@ -509,15 +509,12 @@ def random_transaction(nodes, amount, min_fee, fee_increment, fee_variants):
|
|||
|
||||
def assert_fee_amount(fee, tx_size, fee_per_kB):
|
||||
"""Assert the fee was in range"""
|
||||
target_fee = fee_per_kB / 1000
|
||||
target_fee = tx_size * fee_per_kB / 1000
|
||||
if fee < target_fee:
|
||||
raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)"%(str(fee), str(target_fee)))
|
||||
raise AssertionError("Fee of %s DOGE too low! (Should be %s DOGE)"%(str(fee), str(target_fee)))
|
||||
# allow the wallet's estimation to be at most 2 bytes off
|
||||
if fee > round_tx_size(tx_size + 2) * fee_per_kB / 1000:
|
||||
raise AssertionError("Fee of %s BTC too high! (Should be %s BTC)"%(str(fee), str(target_fee)))
|
||||
|
||||
def round_tx_size(tx_size):
|
||||
return int(math.ceil(tx_size / 1000.0)) * 1000
|
||||
if fee > (tx_size + 2) * fee_per_kB / 1000:
|
||||
raise AssertionError("Fee of %s DOGE too high! (Should be %s DOGE)"%(str(fee), str(target_fee)))
|
||||
|
||||
def assert_equal(thing1, thing2, *args):
|
||||
if thing1 != thing2 or any(thing1 != arg for arg in args):
|
||||
|
|
|
@ -49,7 +49,7 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
|
||||
# First: use raw transaction API to send 7440000 DOGE to node1_address,
|
||||
# but don't broadcast:
|
||||
doublespend_fee = Decimal('-120')
|
||||
doublespend_fee = Decimal('-1.20')
|
||||
rawtx_input_0 = {}
|
||||
rawtx_input_0["txid"] = fund_foo_txid
|
||||
rawtx_input_0["vout"] = find_output(self.nodes[0], fund_foo_txid, 7314000)
|
||||
|
|
|
@ -116,7 +116,7 @@ class WalletTest (BitcoinTestFramework):
|
|||
|
||||
# Send 100000 DOGE normal
|
||||
address = self.nodes[0].getnewaddress("test")
|
||||
fee_per_byte = Decimal('1') / 1000
|
||||
fee_per_byte = Decimal('0.01') / 1000
|
||||
self.nodes[2].settxfee(fee_per_byte * 1000)
|
||||
txid = self.nodes[2].sendtoaddress(address, 100000, "", "", False)
|
||||
self.nodes[2].generate(1)
|
||||
|
|
|
@ -25,21 +25,6 @@ CAmount CFeeRate::GetFee(size_t nBytes_) const
|
|||
assert(nBytes_ <= uint64_t(std::numeric_limits<int64_t>::max()));
|
||||
int64_t nSize = int64_t(nBytes_);
|
||||
|
||||
// Dogecoin: Round up to the nearest 1000 bytes so we get round tx fees
|
||||
if (nSize % 1000 > 0) {
|
||||
nSize = nSize + 1000 - (nSize % 1000);
|
||||
}
|
||||
|
||||
return GetRelayFee(nSize);
|
||||
}
|
||||
|
||||
// Dogecoin: Specifically for 1.14.4 we lower accepted relay fees by removing rounding,
|
||||
// in 1.14.5 we should unify the GetFee() functions again.
|
||||
CAmount CFeeRate::GetRelayFee(size_t nBytes_) const
|
||||
{
|
||||
assert(nBytes_ <= uint64_t(std::numeric_limits<int64_t>::max()));
|
||||
int64_t nSize = int64_t(nBytes_);
|
||||
|
||||
CAmount nFee = nSatoshisPerK * nSize / 1000;
|
||||
|
||||
if (nFee == 0 && nSize != 0) {
|
||||
|
|
|
@ -47,7 +47,7 @@ CAmount GetDogecoinMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool
|
|||
return 0;
|
||||
}
|
||||
|
||||
CAmount nMinFee = ::minRelayTxFeeRate.GetRelayFee(nBytes);
|
||||
CAmount nMinFee = ::minRelayTxFeeRate.GetFee(nBytes);
|
||||
nMinFee += GetDogecoinDustFee(tx.vout, ::minRelayTxFeeRate);
|
||||
|
||||
if (fAllowFree)
|
||||
|
|
|
@ -490,7 +490,7 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda
|
|||
packageSigOpsCost = modit->nSigOpCostWithAncestors;
|
||||
}
|
||||
|
||||
if (packageFees < blockMinFeeRate.GetRelayFee(packageSize)) {
|
||||
if (packageFees < blockMinFeeRate.GetFee(packageSize)) {
|
||||
// Everything else we might consider has a lower fee rate
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ static const CAmount DUST_RELAY_TX_FEE = COIN / 100000;
|
|||
* transaction output is required to pay additional fee for relay and inclusion
|
||||
* in blocks. Overridden by -dustlimit
|
||||
*/
|
||||
static const CAmount DEFAULT_DUST_LIMIT = COIN / 1;
|
||||
static const CAmount DEFAULT_DUST_LIMIT = COIN / 100;
|
||||
|
||||
/**
|
||||
* Standard script verification flags that standard transactions will comply
|
||||
|
|
|
@ -19,47 +19,39 @@ BOOST_AUTO_TEST_CASE(GetFeeTest)
|
|||
BOOST_CHECK_EQUAL(feeRate.GetFee(1e5), 0);
|
||||
|
||||
feeRate = CFeeRate(1000);
|
||||
// Wallet fees are rounded up
|
||||
// Wallet fees are no longer rounded up
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(0), 0);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1), 1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(121), 1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(999), 1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1), 1);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(121), 121);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(999), 999);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1e3), 1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9e3), 9000);
|
||||
|
||||
// Relay fees must always just return the arg
|
||||
BOOST_CHECK_EQUAL(feeRate.GetRelayFee(0), 0);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetRelayFee(1), 1);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetRelayFee(121), 121);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetRelayFee(999), 999);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetRelayFee(1e3), 1e3);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetRelayFee(9e3), 9e3);
|
||||
|
||||
feeRate = CFeeRate(-1000);
|
||||
// Must always just return -1 * arg
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(0), 0);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1), -1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(121), -1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(999), -1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1), -1);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(121), -121);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(999), -999);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1e3), -1000);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9e3), -9000);
|
||||
|
||||
feeRate = CFeeRate(123);
|
||||
// Truncates the result, if not integer
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(0), 0);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(8), 123); // Special case: returns 1 instead of 0
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9), 123);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(121), 123);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(122), 123);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(999), 123);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(8), 1); // Special case: returns 1 instead of 0
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9), 1);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(121), 14);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(122), 15);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(999), 122);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(1e3), 123);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9e3), 1107);
|
||||
|
||||
feeRate = CFeeRate(-123);
|
||||
// Truncates the result, if not integer
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(0), 0);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(8), -123); // Special case: returns -1 instead of 0
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9), -123);
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(8), -1); // Special case: returns -1 instead of 0
|
||||
BOOST_CHECK_EQUAL(feeRate.GetFee(9), -1);
|
||||
|
||||
// Check full constructor
|
||||
// default value
|
||||
|
|
|
@ -121,7 +121,7 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
|
|||
|
||||
// Calculate a fee on child transaction that will put the package just
|
||||
// below the block min tx fee (assuming 1 child tx of the same size).
|
||||
CAmount feeToUse = blockMinFeeRate.GetRelayFee(2*freeTxSize) - 1;
|
||||
CAmount feeToUse = blockMinFeeRate.GetFee(2*freeTxSize) - 1;
|
||||
|
||||
tx.vin[0].prevout.hash = hashFreeTx;
|
||||
tx.vout[0].nValue = 5000000000LL - 1000 - 50000 - feeToUse;
|
||||
|
@ -158,7 +158,7 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
|
|||
// This tx can't be mined by itself
|
||||
tx.vin[0].prevout.hash = hashFreeTx2;
|
||||
tx.vout.resize(1);
|
||||
feeToUse = blockMinFeeRate.GetRelayFee(freeTxSize);
|
||||
feeToUse = blockMinFeeRate.GetFee(freeTxSize);
|
||||
tx.vout[0].nValue = 5000000000LL - 100000000 - feeToUse;
|
||||
uint256 hashLowFeeTx2 = tx.GetHash();
|
||||
mempool.addUnchecked(hashLowFeeTx2, entry.Fee(feeToUse).SpendsCoinbase(false).FromTx(tx));
|
||||
|
|
|
@ -786,10 +786,10 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
|||
return state.DoS(0, false, REJECT_NONSTANDARD, "bad-txns-too-many-sigops", false,
|
||||
strprintf("%d", nSigOpsCost));
|
||||
|
||||
CAmount mempoolRejectFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetRelayFee(nSize);
|
||||
CAmount mempoolRejectFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFee(nSize);
|
||||
if (mempoolRejectFee > 0 && nModifiedFees < mempoolRejectFee) {
|
||||
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "mempool min fee not met", false, strprintf("%d < %d", nFees, mempoolRejectFee));
|
||||
} else if (GetBoolArg("-relaypriority", DEFAULT_RELAYPRIORITY) && nModifiedFees < ::minRelayTxFeeRate.GetRelayFee(nSize) && !AllowFree(entry.GetPriority(chainActive.Height() + 1))) {
|
||||
} else if (GetBoolArg("-relaypriority", DEFAULT_RELAYPRIORITY) && nModifiedFees < ::minRelayTxFeeRate.GetFee(nSize) && !AllowFree(entry.GetPriority(chainActive.Height() + 1))) {
|
||||
// Require that free transactions have sufficient priority to be mined in the next block.
|
||||
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority");
|
||||
}
|
||||
|
@ -966,14 +966,14 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
|||
// Finally in addition to paying more fees than the conflicts the
|
||||
// new transaction must pay for its own bandwidth.
|
||||
CAmount nDeltaFees = nModifiedFees - nConflictingFees;
|
||||
if (nDeltaFees < ::incrementalRelayFee.GetRelayFee(nSize))
|
||||
if (nDeltaFees < ::incrementalRelayFee.GetFee(nSize))
|
||||
{
|
||||
return state.DoS(0, false,
|
||||
REJECT_INSUFFICIENTFEE, "insufficient fee", false,
|
||||
strprintf("rejecting replacement %s, not enough additional fees to relay; %s < %s",
|
||||
hash.ToString(),
|
||||
FormatMoney(nDeltaFees),
|
||||
FormatMoney(::incrementalRelayFee.GetRelayFee(nSize))));
|
||||
FormatMoney(::incrementalRelayFee.GetFee(nSize))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,12 @@ static const bool DEFAULT_WHITELISTFORCERELAY = true;
|
|||
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
||||
static const CAmount DEFAULT_MIN_RELAY_TX_FEE = COIN / 1000;
|
||||
//! -maxtxfee default
|
||||
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 400 * COIN;
|
||||
//rnicoll: 8/2021 scaled down as recommended fee is lowered
|
||||
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 100 * COIN;
|
||||
//! Discourage users to set fees higher than this amount (in satoshis) per kB
|
||||
//mlumin: 5/2021 adjusted downward for fee revisions
|
||||
static const CAmount HIGH_TX_FEE_PER_KB = 10 * COIN;
|
||||
//rnicoll: 8/2021 scale further down as recommended fee is lowered
|
||||
static const CAmount HIGH_TX_FEE_PER_KB = COIN;
|
||||
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
|
||||
//mlumin: 5/2021 adjusted max upward in terms of coin
|
||||
static const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB;
|
||||
|
|
|
@ -502,11 +502,11 @@ BOOST_AUTO_TEST_CASE(GetMinimumFee_test)
|
|||
CTxOut txout1(value, (CScript)vector<unsigned char>(24, 0));
|
||||
tx.vout.push_back(txout1);
|
||||
|
||||
int64_t nMinTxFee = COIN;
|
||||
int64_t nMinTxFee = COIN / 100;
|
||||
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 250, 0, pool), nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), 2 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 250, 0, pool), nMinTxFee * 0.25);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), nMinTxFee * 1.0);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), nMinTxFee * 1.999);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GetMinimumFee_dust_test)
|
||||
|
@ -515,27 +515,28 @@ BOOST_AUTO_TEST_CASE(GetMinimumFee_dust_test)
|
|||
CMutableTransaction tx;
|
||||
CTxMemPool pool(payTxFee);
|
||||
CTxOut txout1(139496846, (CScript)vector<unsigned char>(24, 0)); // Regular output
|
||||
CTxOut txout2(15499649, (CScript)vector<unsigned char>(24, 0)); // Dust output
|
||||
CTxOut txout2(154996, (CScript)vector<unsigned char>(24, 0)); // Dust output
|
||||
tx.vout.push_back(txout1);
|
||||
tx.vout.push_back(txout2);
|
||||
|
||||
int64_t nMinTxFee = COIN;
|
||||
CAmount nMinTxFee = COIN / 100;
|
||||
|
||||
// Confirm dust penalty fees are added on
|
||||
CAmount nDustPenalty = COIN / 100;
|
||||
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 963, 0, pool), 2 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), 2 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), 3 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 963, 0, pool), nDustPenalty + (nMinTxFee * 0.963));
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), nDustPenalty + (nMinTxFee * 1.000));
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), nDustPenalty + (nMinTxFee * 1.999));
|
||||
|
||||
// change the hard dust limit
|
||||
|
||||
nDustLimit = COIN / 10;
|
||||
nDustLimit = COIN / 1000;
|
||||
|
||||
// Confirm dust penalty fees are not added
|
||||
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 963, 0, pool), 1 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), 1 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), 2 * nMinTxFee);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 963, 0, pool), nMinTxFee * 0.963);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1000, 0, pool), nMinTxFee * 1.000);
|
||||
BOOST_CHECK_EQUAL(CWallet::GetMinimumFee(tx, 1999, 0, pool), nMinTxFee * 1.999);
|
||||
|
||||
nDustLimit = COIN;
|
||||
}
|
||||
|
|
|
@ -47,20 +47,21 @@ extern bool fWalletRbf;
|
|||
|
||||
static const unsigned int DEFAULT_KEYPOOL_SIZE = 100;
|
||||
//! -paytxfee default
|
||||
static const CAmount DEFAULT_TRANSACTION_FEE = COIN;
|
||||
static const CAmount DEFAULT_TRANSACTION_FEE = COIN / 100;
|
||||
//! -fallbackfee default
|
||||
//mlumin: 5/2021 scaled minimum, this likely will have to change for fee reduction
|
||||
static const CAmount DEFAULT_FALLBACK_FEE = COIN;
|
||||
//rnicoll: 8/2021 reduce to 1,000,000 Koinu
|
||||
static const CAmount DEFAULT_FALLBACK_FEE = COIN / 100;
|
||||
//! -mintxfee default
|
||||
static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN;
|
||||
static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN / 100;
|
||||
//mlumin 5/2021: adding a minimum Wallet fee vs relay, currently still 1 COIN, to be reduced.
|
||||
static const CAmount DEFAULT_MIN_WALLET_TX_FEE = COIN;
|
||||
static const CAmount DEFAULT_MIN_WALLET_TX_FEE = COIN / 100;
|
||||
//! minimum recommended increment for BIP 125 replacement txs
|
||||
static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN/10 * 5;
|
||||
//! target minimum change amount
|
||||
static const CAmount MIN_CHANGE = COIN;
|
||||
static const CAmount MIN_CHANGE = COIN / 100;
|
||||
//! final minimum change amount after paying for fees
|
||||
static const CAmount MIN_FINAL_CHANGE = COIN;
|
||||
static const CAmount MIN_FINAL_CHANGE = COIN / 100;
|
||||
//! Default for -spendzeroconfchange
|
||||
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true;
|
||||
//! Default for -sendfreetransactions
|
||||
|
|
Loading…
Reference in New Issue