Commit graph

15 commits

Author SHA1 Message Date
James O'Beirne
8a3b2eb175 move-only: move coins statistics utils out of RPC
These procedures will later be used in the ChainstateManager to compute
statistics (particularly a content hash) for UTXO sets coming in from
snapshots.
2019-08-27 11:51:56 -04:00
MarcoFalke
85883a9f8e
Merge #16443: refactor: have CCoins* data managed under CChainState
582d2cd747 Cover UTXO set access with lock annotations (James O'Beirne)
5693530685 refactor: have CCoins* data managed under CChainState (James O'Beirne)
fae6ab6aed refactor: pcoinsTip -> CChainState::CoinsTip() (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/2019-04-proposal/proposal

  ---

  This change encapsulates UTXO set data within CChainState instances, removing global data `pcoinsTip` and `pcoinsviewdb`. This is necessary if we want to maintain multiple chainstates with their own rendering of the UTXO set.

  We introduce a class CoinsViews which consolidates the construction of a CCoins* hierarchy.

  This commit could be broken into smaller pieces, but it would require more ephemeral diffs to, e.g., temporarily change CCoinsViewDB's constructor invocations.

ACKs for top commit:
  Sjors:
    reACK 582d2cd747
  MarcoFalke:
    ACK 582d2cd747

Tree-SHA512: ec9d904fe5dca8cd2dc4b7916daa5d8bab30856dd4645987300f905e0a19f9919fce4f9d1ff03eda982943ca73e6e9a746be6cf53b46510de36e8c81a1eafba1
2019-08-15 12:47:15 -04:00
Antoine Riard
b7b9f6e4ce Remove p2pEnabled from Chain interface
RPC server starts in warmup mode, it can't
process yet calls, then follows connection manager
initialization and finally RPC server get out of
warmup mode. RPC calls shouldn't be able to get
P2P disabled errors because once we initialize
g_connman it's not unset until shutdown, after
RPC server has been stopped.
2019-08-08 22:57:35 -04:00
James O'Beirne
fae6ab6aed refactor: pcoinsTip -> CChainState::CoinsTip()
This aliasing makes subsequent commits easier to review; eventually CoinsTip()
will return the CCoinsViewCache managed by CChainState.
2019-08-06 13:13:06 -04:00
John Newbery
fb62f128bb Tidy up BroadcastTransaction() 2019-08-01 13:43:29 -04:00
Antoine Riard
8c8aa19b4b Add BroadcastTransaction utility usage in Chain interface
Access through a broadcastTransaction method.
Add a wait_callback flag to turn off race protection when wallet
already track its tx being in mempool

Standardise highfee, absurdfee variable name to max_tx_fee

We drop the P2P check in BroadcastTransaction as g_connman is only
called by RPCs and the wallet scheduler, both of which are initialized
after g_connman is assigned and stopped before g_connman is reset.
2019-08-01 13:43:26 -04:00
Antoine Riard
9bc8b28c1d refactor : use RelayTransaction in BroadcastTransaction utility
To do so, we also refactor RelayTransaction to take a txid
instead of passing a tx
2019-07-24 19:47:56 -04:00
Russell Yanofsky
4d074e84a2 [build] Move AnalyzePSBT from psbt.cpp to node/psbt.cpp
psbt.cpp definitions except for AnalyzePSBT are used by the wallet and need to
be linked into the wallet binary. AnalyzePSBT is an exception in that it is not
used by the wallet, and depends on node classes like CCoinsViewCache, and on
node global variables like nBytesPerSigOp.

So AnalyzePSBT is more at home in libbitcoin_server than libbitcoin_common, and
in any case needs to be defined in a separate object file than other PSBT
utilities, to avoid dragging link dependencies on node functions and global
variables into the wallet.
2019-04-09 17:53:08 -04:00
John Newbery
fd509bd1f7 [docs] Document src subdirectories and different libraries 2019-04-09 17:53:08 -04:00
John Newbery
91a25d1e71 [build] Add several util units
Adds the following util units and adds them to libbitcoin_util:

- `util/url.cpp` takes `urlDecode` from `httpserver.cpp`
- `util/error.cpp` takes `TransactionErrorString` from
  `node/transaction.cpp` and `AmountHighWarn` and `AmountErrMsg` from
  `ui_interface.cpp`
- `util/fees.cpp` takes `StringForFeeReason` and `FeeModeFromString` from `policy/fees.cpp`
- `util/rbf.cpp` takes `SignalsOptInRBF` from `policy/rbf.cpp`
- 'util/validation.cpp` takes `FormatStateMessage` and `strMessageMagic` from 'validation.cpp`
2019-04-09 17:53:08 -04:00
Russell Yanofsky
b1b2b23892 Remove use of CCoinsViewMemPool::GetCoin in wallet code
This commit does not change behavior.
2019-03-05 10:20:00 -04:00
MarcoFalke
fa9b60c842
Remove unused TransactionError constants 2019-02-14 10:32:02 -05:00
Glenn Willen
102faad81e Factor out combine / finalize / extract PSBT helpers
Refactor the new CombinePSBT, FinalizePSBT, and FinalizeAndExtractPSBT
general-purpose functions out of the combinepsbt and finalizepsbt RPCs,
for use in the GUI code.
2019-02-11 14:08:04 -08:00
Glenn Willen
bd0dbe8763 Switch away from exceptions in refactored tx code
After refactoring general-purpose PSBT and transaction code out of RPC code,
for use in the GUI, it's no longer appropriate to throw exceptions. Instead we
now return bools for success, and take an output parameter for an error object.
We still use JSONRPCError() for the error objects, since only RPC callers
actually care about the error codes.
2019-02-11 14:08:04 -08:00
Glenn Willen
81cd958848 Factor BroadcastTransaction out of sendrawtransaction
Factor out a new BroadcastTransaction function, performing the core work of the
sendrawtransaction rpc, so that it can be used from the GUI code. Move it from
src/rpc/ to src/node/.
2019-02-11 12:23:14 -08:00