Page MenuHomePhabricator

D10716.diff
No OneTemporary

D10716.diff

diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -3799,8 +3799,8 @@
}
void FundTransaction(CWallet *const pwallet, CMutableTransaction &tx,
- Amount &fee_out, int &change_position, UniValue options,
- CCoinControl &coinControl) {
+ Amount &fee_out, int &change_position,
+ const UniValue &options, CCoinControl &coinControl) {
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
@@ -4825,7 +4825,8 @@
"subtract_fee_from_outputs",
RPCArg::Type::ARR,
/* default */ "empty array",
- "A JSON array of integers.\n"
+ "Outputs to subtract the fee from, specified as integer "
+ "indices.\n"
"The fee will be equally deducted from the amount of each "
"specified output.\n"
"Those recipients will receive less bitcoins than you "
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -118,42 +118,32 @@
self.nodes[1].sendrawtransaction(
self.nodes[1].finalizepsbt(walletprocesspsbt_out['psbt'])['hex'])
- # feeRate of 100,000 XEC / KB produces a total fee slightly below
- # -maxtxfee
+ inputs = [{"txid": txid, "vout": p2sh_pos},
+ {"txid": txid, "vout": p2pkh_pos}]
+ output = {self.nodes[1].getnewaddress(): 29_990_000}
+
+ self.log.info(
+ "Test walletcreatefundedpsbt feeRate of 100,000 XEC/kB produces a "
+ "total fee at or slightly below -maxtxfee")
res = self.nodes[1].walletcreatefundedpsbt(
- [
- {
- "txid": txid, "vout": p2sh_pos}, {
- "txid": txid, "vout": p2pkh_pos}], {
- self.nodes[1].getnewaddress(): 29990000}, 0, {
- "feeRate": 100000, "add_inputs": True})
+ inputs, output, 0, {"feeRate": 100_000, "add_inputs": True})
assert_approx(res["fee"], 65000, 5000)
- # feeRate of 10,000,000 XEC / KB produces a total fee well above -maxtxfee
+ self.log.info(
+ "Test walletcreatefundedpsbt feeRate of 10,000,000 XEC/kB produces "
+ "a total fee well above -maxtxfee and raises RPC error")
# previously this was silently capped at -maxtxfee
- assert_raises_rpc_error(-4,
- "Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)",
- self.nodes[1].walletcreatefundedpsbt,
- [{"txid": txid,
- "vout": p2sh_pos},
- {"txid": txid,
- "vout": p2pkh_pos}],
- {self.nodes[1].getnewaddress(): 29990000},
- 0,
- {"feeRate": 10000000,
- "add_inputs": True})
- assert_raises_rpc_error(-4,
- "Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)",
- self.nodes[1].walletcreatefundedpsbt,
- [{"txid": txid,
- "vout": p2sh_pos},
- {"txid": txid,
- "vout": p2pkh_pos}],
- {self.nodes[1].getnewaddress(): 1000000},
- 0,
- {"feeRate": 10000000,
- "add_inputs": False})
-
+ for bool_add, output_ in (
+ (True, output),
+ (False, {self.nodes[1].getnewaddress(): 1_000_000})):
+ assert_raises_rpc_error(
+ -4,
+ "Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)",
+ self.nodes[1].walletcreatefundedpsbt,
+ inputs, output_, 0,
+ {"feeRate": 10_000_000, "add_inputs": bool_add})
+
+ self.log.info("Test various PSBT operations")
# partially sign multisig things with node 1
psbtx = self.nodes[1].walletcreatefundedpsbt([{"txid": txid, "vout": p2sh_pos}], {
self.nodes[1].getnewaddress(): 9990000})['psbt']
diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py
--- a/test/functional/wallet_basic.py
+++ b/test/functional/wallet_basic.py
@@ -228,6 +228,8 @@
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal(
'20000000'), fee_per_byte, count_bytes(self.nodes[2].gettransaction(txid)['hex']))
+ self.log.info("Test sendmany")
+
# Sendmany 10,000,000 XEC
txid = self.nodes[2].sendmany('', {address: 10000000}, 0, "", [])
self.nodes[2].generate(1)

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 10:59 (11 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187443
Default Alt Text
D10716.diff (5 KB)

Event Timeline