Commit graph

143 commits

Author SHA1 Message Date
Roy Lee
0410b7ce01 consolidate: merge internal/external branches 2022-09-28 11:48:23 -07:00
Roy Lee
610ec20ea8 ci: run "make fmt" 2022-08-08 01:26:02 -07:00
Roy Lee
49e78d88cb [lbry] rpc: support --skipverify on TLS connection to lbcd 2022-05-24 10:48:28 -07:00
Brannon King
1d0ef1da6d [lbry] added staked value to balance call 2022-05-24 10:48:28 -07:00
Brannon King
23f883be7e [lbry] eliminated btcd dependency 2022-05-24 10:48:28 -07:00
Roy Lee
10d0a26792 [lbry] update backend list 2022-05-24 10:31:06 -07:00
Roy Lee
879bf10dde [lbry] chain: bring back removed chainParams for a testcase 2022-05-24 10:31:06 -07:00
Roy Lee
202374ebd8 [lbry] fork from btcsuite to lbryio
1. btcd -> lbcd
2. btcwallet -> lbcallet
3. btcutil -> lbcutil
2022-05-24 10:31:06 -07:00
Roy Lee
8701ecb329 [lbry] build: remove neutrino and bitcoind support 2022-05-24 03:09:34 -07:00
Olaoluwa Osuntokun
6eede89a43 chain: fix peer selection for the pruned block dispatcher
In this commit, we fix the peer selection for the pruned block
dispatcher. Turns out that the bits are actually mutually exclusive: a
node can set the network bit _and_ the limited (pruned bit).

The prior logic would only seek out "pure" nodes, meaning older nodes
that wouldn't set the limited bit when they're a full-full node. We fix
this by ignoring the limited bit, and we'll only look at the network and
segwit bits.

A unit test has also been added to show the issue in the prior filter
function.
2022-05-24 03:09:34 -07:00
Olaoluwa Osuntokun
0b7de5efbb
Merge pull request #735 from guggero/signet
Update btcd dependency, add Signet params
2021-04-27 17:04:10 -07:00
Oliver Gugger
1f1ffb56b5
multi: add signet params
With this commit we add the signet test network parameters to all switch
cases where we distinguish between the different networks.
2021-04-27 09:59:14 +02:00
Wilmer Paulino
526d132f09
chain: implement GetNodeAddresses fallback for PrunedBlockDispatcher
It's possible for bitcoind instances to only have connections to pruned
nodes after its initial block download, which are incompatible with the
PrunedBlockDispatcher. This would result in GetBlock requests for pruned
blocks to never resolve. Since bitcoind also exposes a GetNodeAddresses
RPC, which returns random reachable addresses from its address manager,
we can leverage it to obtain a new candidate set of peers that we
otherwise wouldn't obtain through GetPeers.
2021-04-23 13:28:56 -07:00
Wilmer Paulino
f7241cd95f
chain: prevent logging of ping/pong msgs in PrunedBlockDispatcher
These messages are also part of normal operation, so we should log
stating they are unexpected.
2021-04-23 13:28:55 -07:00
Wilmer Paulino
61d3b2da6d
chain: use correct pruned node service bit 2021-04-23 13:28:55 -07:00
Olaoluwa Osuntokun
2ff451f6bc
chain: fix alignment of atomic integers in bitcoind conn struct
As reported by https://github.com/lightningnetwork/lnd/issues/5196, the
new atomic integer isn't properly aligned which can caus panics on
32-bit operating systems.. Tof fix this issue, we move the 64-bit
integer to lay after the two 32-bit integers at the top of the struct.
2021-04-11 16:32:45 -07:00
Wilmer Paulino
20c02df1e3
chain: request pruned blocks from backend peers
At the moment, this is only done for the BitcoindClient, as the other
backends don't support block pruning.
2021-04-02 17:28:07 -07:00
Wilmer Paulino
3fed46822c
chain: refactor BitcoindConn init params into config struct 2021-04-02 17:28:06 -07:00
Wilmer Paulino
178d124b76
chain: add PrunedBlockDispatcher implementation
To minimally support wallets connected to pruned nodes, we add a new
subsystem that can be integrated with chain clients to request blocks
that the server has already pruned. This is done by connecting to the
server's full node peers and querying them directly. Ideally, this is a
capability supported by the server, though this is not yet possible with
bitcoind.
2021-04-02 17:28:05 -07:00
Oliver Gugger
3a5d9f84b0
multi: fix linter issues 2021-03-24 14:44:32 +01:00
Wilmer Paulino
90a0744ae4
chain: batch filter fetches for neutrino chain client
This greatly speeds up wallet recovery with a neutrino backend, as we'll
avoid unnecessary round trips for each block filter fetch.
2020-03-31 13:37:56 -07:00
Wilmer Paulino
d7d2f14d61
build+chain: reuse buffers when reading ZMQ messages from bitcoind
`bitcoind` notifies transactions once they're accepted into the mempool
and once they're confirmed in a block. Previously, reading a message
from ZMQ would allocate a buffer with the size of the message. This can
cause nodes to perform a large number of allocations within a small
amount periodically (3000 300B allocations every 10 mins on average),
which can cause a lot of GC pressure on lower resourced nodes. To remedy
this, we introduce two static buffers, one for blocks and another for
transactions, that will be reused for every message read. Each is
constrained by its maximum expected size.
2019-11-12 18:18:59 -08:00
Wilmer Paulino
58ac163d48
chain: trace log timed out ZMQ connections 2019-11-08 12:39:00 -08:00
Wilmer Paulino
36ca842905
chain: extract ZMQ command strings into constants 2019-11-08 12:38:28 -08:00
Wilmer Paulino
333ecbf262 chain: notify block when not filtered for BitcoindClient 2019-09-09 17:10:38 +03:00
Olaoluwa Osuntokun
cfb9bb1e32
build: pin against latest neutrino version 2019-09-05 18:31:03 -07:00
Wilmer Paulino
5124978a9b
chain: prevent filtering blocks when BitcoindClient has an empty filter 2019-08-09 18:16:40 -07:00
Wilmer Paulino
6c4dab5f7c
chain: remove extraneous rpcclient.Disconnect calls from BitcoindConn
These are not needed since they have no effect when the RPC client is
making HTTP POST requests.
2019-07-10 16:15:51 -07:00
Wilmer Paulino
f02166e5de
chain: explicitly close connections in BitcoindConn's Stop method
Since it's now possible for gozmq.Conn to block when calling Receive,
BitcoindConn hangs upon being stopped because its goroutines are waiting
for a message to be delivered. To address this, we modify it to close
its ZMQ connections driving the goroutines once it's been stopped. This
allows the goroutines to unblock by detecting the EOF error and exiting.
2019-07-10 16:15:50 -07:00
Wilmer Paulino
4a913d02ea
chain: only allow bitcoind block notifications at tip after NotifyBlocks
One could argue that the behavior before this commit was incorrect, as
the ChainClient interface expects a call to NotifyBlocks before
notifying blocks at tip, so we decide to fix this.

Since we now wait for the chain backend to be considered "current"
before proceeding to sync the wallet with it, any blocks that were
processed while waiting would result in being notified and scanned
twice, once by processing it at tip, and another while rescanning the
wallet, which is not desirable.
2019-06-13 18:09:06 -07:00
Wilmer Paulino
39f81c630b
chain: add IsCurrent method to chain.Interface
IsCurrent allows us to determine if the chain backend considers itself
"current" with the chain.
2019-06-13 18:08:59 -07:00
Wilmer Paulino
eedd5ce1b6
chain: prevent deadlock while notifying RescanFinished for NeutrinoClient 2019-06-07 13:00:09 -07:00
Wilmer Paulino
0efe836773
chain: avoid using defer for BitcoindClient onRescanFinished notification
Since defer will copy the function with the parameters evaluated at its
invocation, the RescanFinished notification would be dispatched with the
incorrect block. To fix this, we'll just send the notification at the
end ourselves manually.
2019-05-11 13:06:25 -07:00
Wilmer Paulino
28161bee42
chain: improve error logging within BitcoindClient.reorg 2019-05-11 13:05:27 -07:00
Wilmer Paulino
ecfebcea03
chain: remove unnecessary returned error from BitcoindClient.filterBlock 2019-05-11 13:05:23 -07:00
Wilmer Paulino
8d6dd92706
chain: fix Fatalf format verb error 2019-05-11 13:05:17 -07:00
Wilmer Paulino
e0f82255c7
chain: prevent panic if onBlockConnected is called before onFilteredBlockConnected 2019-04-19 12:27:33 -07:00
Wilmer Paulino
b3643ed7a9
chain: dispatch RescanFinished notification after BlockConnected
In this commit, we address a bug within the wallet when running with
Neutrino where it wouldn't be able to mark it as synced with the chain
due to not receiving a RescanFinished notification if it was a block
behind the chain. This happened because of the order in which the
notifications are delivered within the underlying Neutrino ChainService,
FilteredBlockConnected gets dispatched before BlockConnected. This
doesn't always work however because there is an implicit dependency
between them in which BlockConnected must occur first.

To address it, rather than switching the order in which the
notifications are dispatched, we just check if we can dispatch the final
RescanFinished notification after dispatching BlockConnected.

Co-Authored-By: Roei Erez <roeierez@gmail.com>
2019-04-18 19:32:37 -07:00
Wilmer Paulino
767a7a95cf
chain: extract RescanFinished notification dispatch into method
Co-Authored-By: Roei Erez <roeierez@gmail.com>
2019-04-18 19:30:40 -07:00
Wilmer Paulino
8f25b8b4ef
chain: keep track of lastFilteredBlockHeader within NeutrinoClient
Co-Authored-By: Roei Erez <roeierez@gmail.com>
2019-04-18 19:23:05 -07:00
Olaoluwa Osuntokun
d9a9f4176b
build+chain: update to latest version of neutrino
The latest version also includes a change to the way we need to
initialize the rescan object.
2019-03-12 21:05:42 -07:00
Wilmer Paulino
ec210ad79c
chain/bitcoind_client: extend filterTx with script spend support
In this commit, we extend the BitcoindClient to properly detect the
spend of an arbitrary script on-chain. This is possible by looking at a
transaction's input and re-deriving the PkScript, from its signature
script/witness, of the output it's attempting to spend. Upon detecting
the spend, a chain.RelevantTx will be dispatched.
2019-01-14 18:38:45 -08:00
Johan T. Halseth
060361939b
chain/neutrino: use new neutrino API 2018-10-16 18:18:46 -07:00
Wilmer Paulino
1ddb9f2c11
chain: allow setting the client's birthday after creation 2018-09-12 14:24:30 -07:00
Olaoluwa Osuntokun
0059b9fcd9
Merge pull request #537 from cfromknecht/dont-print-rawtx-garbage
chain/bitcoind_conn: only print ASCII rawtx event types
2018-09-03 17:55:49 -07:00
Conner Fromknecht
042d409236
chain/bitcoind_conn: only print ASCII rawtx event types 2018-08-31 16:31:29 -07:00
Wilmer Paulino
d179c276b4
chain/rpc: remove unnecessary ping keep alive
In this commit, we remove the keep-alive logic within the handler of the
RPCClient struct as this logic already exists within the backing
rpclient.Client instance. In this case, we'd completely stop the
connection after the ping timeout (1 min), which would render the
reconnection logic within rpcclient.Client useless.
2018-08-27 17:25:16 -07:00
Olaoluwa Osuntokun
caab9f91f0
chain: update neutrino client due to recent API changes 2018-08-22 20:20:31 -07:00
Wilmer Paulino
850ad0959a
chain: ensure eventType from ZMQ response is human-readable
In this commit, we fix a small issue where it's possible that we read a
malformed message from the ZMQ connection to bitcoind due to it shutting
down. To fix this, we ensure that the event type is human readable
before attempting to log it.
2018-08-15 18:17:29 -07:00
Wilmer Paulino
d6155a55e9
chain: improve error when filtering blocks and transactions 2018-08-15 17:37:04 -07:00