Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501"Input weights should be specified in inputs rather than in options.",502ext_wallet.send,503outputs={self.nodes[0].getnewaddress(): 15},504options={"inputs": [ext_utxo], "input_weights": [{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": 1000}]}505)507target_fee_rate_sat_vb = 10508# Funding should also work when input weights are provided509res = self.test_send(510from_wallet=ext_wallet,511to_wallet=self.nodes[0],512amount=15,513inputs=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": input_weight}],514add_inputs=True,515psbt=True,516fee_rate=target_fee_rate_sat_vb517)518signed = ext_wallet.walletprocesspsbt(res["psbt"])519signed = ext_fund.walletprocesspsbt(res["psbt"])520assert signed["complete"]521testres = self.nodes[0].testmempoolaccept([signed["hex"]])[0]522assert_equal(testres["allowed"], True)523actual_fee_rate_sat_vb = Decimal(testres["fees"]["base"]) * Decimal(1e8) / Decimal(testres["vsize"])524# Due to ECDSA signatures not always being the same length, the actual fee rate may be slightly different525# but rounded to nearest integer, it should be the same as the target fee rate526assert_equal(round(actual_fee_rate_sat_vb), target_fee_rate_sat_vb)528# Check tx creation size limits529self.test_weight_limits()531def test_weight_limits(self):532self.log.info("Test weight limits")534self.nodes[1].createwallet("test_weight_limits")535wallet = self.nodes[1].get_wallet_rpc("test_weight_limits")537# Generate future inputs; 272 WU per input (273 when high-s).538# Picking 1471 inputs will exceed the max standard tx weight.539outputs = []540for _ in range(1472):541outputs.append({wallet.getnewaddress(address_type="legacy"): 0.1})542self.nodes[0].send(outputs=outputs)543self.generate(self.nodes[0], 1)545# 1) Try to fund transaction only using the preset inputs546inputs = wallet.listunspent()547assert_raises_rpc_error(-4, "Transaction too large",548wallet.send, outputs=[{wallet.getnewaddress(): 0.1 * 1471}], options={"inputs": inputs, "add_inputs": False})550# 2) Let the wallet fund the transaction551assert_raises_rpc_error(-4, "The inputs size exceeds the maximum weight. Please try sending a smaller amount or manually consolidating your wallet's UTXOs",552wallet.send, outputs=[{wallet.getnewaddress(): 0.1 * 1471}])554# 3) Pre-select some inputs and let the wallet fill-up the remaining amount555inputs = inputs[0:1000]556assert_raises_rpc_error(-4, "The combination of the pre-selected inputs and the wallet automatic inputs selection exceeds the transaction maximum weight. Please try sending a smaller amount or manually consolidating your wallet's UTXOs",557wallet.send, outputs=[{wallet.getnewaddress(): 0.1 * 1471}], options={"inputs": inputs, "add_inputs": True})559self.nodes[1].unloadwallet("test_weight_limits")562if __name__ == '__main__':563WalletSendTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.