lbrycrd/src
Glenn Willen db445d4e5a Refactor PSBTInput signing to enforce invariant
Refactor the process of PSBTInput signing to enforce the invariant that
a PSBTInput always has _either_ a witness_utxo or a non_witness_utxo,
never both.

This simplifies the logic of SignPSBTInput slightly, since it no longer
has to deal with the "both" case. When calling it, we now give it, in
order of preference: (1) whichever of the utxo fields was already
present in the PSBT we received, or (2) if neither, the
non_witness_utxo field, which is just a copy of the input transaction,
which we get from the wallet.

SignPSBTInput no longer has to remove one of the two fields; instead, it
will check if we have a witness signature, and if so, it will replace
the non_witness_utxo with the witness_utxo (which is smaller, as it is
just a copy of the output being spent.)

Add PSBTInput::IsSane checks in two more places, which checks for
both utxo fields being present; we will now give an RPC error early on
if we are supplied such a malformed PSBT to fill in.

Also add a check to FillPSBT, to avoid touching any input that is
already signed. (This is now redundant, since we should no longer
potentially harm an already-signed input, but it's harmless.)

fixes #14473

Github-Pull: #14588
2018-12-03 10:37:08 -08:00
..
bench Merge #13666: Always create signatures with Low R values 2018-08-13 12:07:20 +02:00
compat Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
config
consensus Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
crypto Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
index Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
interfaces Ignore unknown config file options for now 2018-07-30 18:01:20 -07:00
leveldb Merge leveldb subtree 2018-08-09 11:31:45 -04:00
obj
obj-test
policy Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
primitives Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
qt qt: Revert "Force TLS1.0+ for SSL connections" 2018-11-06 09:03:28 +01:00
rpc Simplify arguments to SignPSBTInput 2018-12-03 10:36:37 -08:00
script Refactor PSBTInput signing to enforce invariant 2018-12-03 10:37:08 -08:00
secp256k1
support Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
test add test demonstrating addrLocal UB 2018-11-29 18:32:48 +08:00
univalue univalue: Bump subtree 2018-02-10 09:55:54 -05:00
wallet Refactor PSBTInput signing to enforce invariant 2018-12-03 10:37:08 -08:00
zmq Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
.clang-format Fix inconsistent namespace formatting guidelines 2018-04-13 15:37:20 -04:00
addrdb.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrdb.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrman.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
addrman.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
amount.h
arith_uint256.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
arith_uint256.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
base58.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
base58.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
bech32.cpp Tighten up bech32::Decode(); add tests. 2018-04-12 17:52:33 -07:00
bech32.h Fix missing or inconsistent include guards 2018-03-22 16:23:04 +01:00
bitcoin-cli-res.rc
bitcoin-cli.cpp Merge #13905: docs: fixed bitcoin-cli -help output for help2man 2018-08-13 07:33:33 -04:00
bitcoin-tx-res.rc
bitcoin-tx.cpp [docs] Reformat -help output for help2man 2018-08-04 16:17:13 +02:00
bitcoind-res.rc
bitcoind.cpp [docs] Reformat -help output for help2man 2018-08-04 16:17:13 +02:00
blockencodings.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
blockencodings.h disallow oversized CBlockHeaderAndShortTxIDs 2018-11-28 15:35:05 -05:00
bloom.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
bloom.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chain.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chain.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparams.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
chainparams.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
chainparamsbase.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparamsbase.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
chainparamsseeds.h net: Update hardcoded seeds 2018-08-13 13:57:15 +02:00
checkpoints.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
checkpoints.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
checkqueue.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
clientversion.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
clientversion.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
coins.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
coins.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compat.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compressor.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
compressor.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_io.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_memusage.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_read.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
core_write.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
cuckoocache.h Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer conversion 2018-03-27 00:37:20 +02:00
dbwrapper.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
dbwrapper.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
fs.cpp
fs.h
hash.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
hash.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
httprpc.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
httprpc.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
httpserver.cpp Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986) 2018-11-29 18:34:58 +08:00
httpserver.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
indirectmap.h
init.cpp doc: Change documentation for =0 for non-boolean options 2018-09-05 14:39:36 -04:00
init.h Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
key.cpp Merge #13666: Always create signatures with Low R values 2018-08-13 12:07:20 +02:00
key.h Merge #13666: Always create signatures with Low R values 2018-08-13 12:07:20 +02:00
key_io.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
key_io.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
keystore.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
keystore.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
limitedmap.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
logging.cpp Merge #13149: Handle unsuccessful fseek(...):s 2018-05-07 13:39:19 +02:00
logging.h logging: remove unused return value from LogPrintStr 2018-05-02 11:25:20 +02:00
Makefile.am Output descriptors module 2018-07-27 11:52:45 -07:00
Makefile.bench.include Merge #13586: refactor: add benchmarks to bech32::Encode/Decode 2018-07-11 11:44:10 +02:00
Makefile.leveldb.include
Makefile.qt.include scripted-diff: Remove trailing whitespaces 2018-07-24 20:46:23 +01:00
Makefile.qttest.include crypto: cleanup sha256 build 2018-06-06 17:36:53 -04:00
Makefile.test.include Descriptor tests 2018-07-27 11:52:45 -07:00
memusage.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
merkleblock.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
merkleblock.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
miner.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
miner.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
net.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
net.h Merge #13907: Introduce a maximum size for locators. 2018-08-10 19:52:13 +02:00
net_processing.cpp Merge #13907: Introduce a maximum size for locators. 2018-08-10 19:52:13 +02:00
net_processing.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netaddress.cpp fix uninitialized read when stringifying an addrLocal 2018-11-29 18:32:05 +08:00
netaddress.h fix uninitialized read when stringifying an addrLocal 2018-11-29 18:32:05 +08:00
netbase.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netbase.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
netmessagemaker.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
noui.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
noui.h
outputtype.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
outputtype.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pow.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pow.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
prevector.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
protocol.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
protocol.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pubkey.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
pubkey.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
random.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
random.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
rest.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
reverse_iterator.h scripted-diff: Remove trailing whitespaces 2018-07-24 20:46:23 +01:00
reverselock.h
scheduler.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
scheduler.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
serialize.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
shutdown.cpp Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
shutdown.h Break circular dependency: init -> * -> init by extracting shutdown.h 2018-06-25 00:08:49 -04:00
span.h Add more methods to Span class 2018-07-27 11:52:18 -07:00
streams.h Fix PSBT deserialization of 0-input transactions 2018-08-15 09:58:49 +08:00
sync.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
sync.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
threadinterrupt.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
threadinterrupt.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
threadsafety.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
timedata.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
timedata.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
tinyformat.h Fix typos 2018-03-21 08:34:44 +02:00
torcontrol.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
torcontrol.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
txdb.cpp Return void instead of bool for functions that cannot fail 2018-07-27 13:19:03 +02:00
txdb.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
txmempool.cpp Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
txmempool.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
ui_interface.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
ui_interface.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
uint256.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
uint256.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
undo.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
util.cpp util: Report parse errors in configuration file 2018-09-06 13:54:01 +02:00
util.h Merge #12257: [wallet] Use destination groups instead of coins in coin select 2018-07-24 16:34:03 +02:00
utilmemory.h Extract MakeUnique into utilmemory.h 2018-07-17 13:56:21 -04:00
utilmoneystr.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilmoneystr.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utilstrencodings.cpp Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986) 2018-11-29 18:34:58 +08:00
utilstrencodings.h Add SAFE_CHARS[SAFE_CHARS_URI]: Chars allowed in URIs (RFC 3986) 2018-11-29 18:34:58 +08:00
utiltime.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
utiltime.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
validation.cpp Fix crash bug with duplicate inputs within a transaction 2018-09-17 16:14:31 -04:00
validation.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
validationinterface.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
validationinterface.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00
version.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
versionbits.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
versionbits.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
walletinitinterface.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
warnings.cpp Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
warnings.h Merge #13780: 0.17: Pre-branch maintenance 2018-08-08 13:55:27 +02:00