Commit graph

3346 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
a0d1e3e36d
Merge pull request #1431 from wpaulino/var-length-p2pkh
txscript: handle variable length P2PKH signatures in ComputePkScript
2019-06-05 11:43:02 +02:00
Wilmer Paulino
5328af0b63
txscript: refactor ComputePkScript 2019-06-03 13:55:28 -07:00
Wilmer Paulino
545bc5d474
txscript: handle variable length P2PKH signatures in ComputePkScript
Since P2PKH signatures have variable lengths, we would attempt to parse
P2PKH scripts as P2SH if they didn't fit the previous length
constraints.
2019-06-03 13:55:24 -07:00
Olaoluwa Osuntokun
16327141da
Merge pull request #1428 from wpaulino/sendrawtransaction-rpc-error
btcjson+rpc: match bitcoind's RPC error codes for rejected transactions
2019-05-22 17:01:18 -07:00
Wilmer Paulino
d055892599
btcjson+rpc: match bitcoind's RPC error codes for rejected transactions 2019-05-22 13:08:12 -07:00
Olaoluwa Osuntokun
96897255fd
Merge pull request #1417 from cfromknecht/detect-sync-stall
netsync/manager: detect stalled sync peer
2019-04-26 17:42:31 -07:00
Conner Fromknecht
e7f9935099
netsync/manager: add syncPeer stall detector
Adds stall detection when no blocks have been received from the sync
peer for at least 3 minutes.

The change backports parts of https://github.com/gcash/bchd/pull/105,
though has different behavior, such as:
 - Rotating the sync peer at tip.
 - Only disconnecting the sync peer if they're height exceeds our own.
   Since we will instead rotate the sync peer at tip, this prevents us
   from disconnecting good peers while waiting for new blocks.
 - Not resetting the progress time when blocks are submitted via rpc.
2019-04-26 17:20:57 -07:00
Conner Fromknecht
a015d8231e
netsync/manager: split out handlePeerDone helpers
Preemptively splits out portions of the handlePeerDone method so that
they can be used in the stall detection logic added in the next commit.
2019-04-26 17:20:57 -07:00
Olaoluwa Osuntokun
63f50db2f7
Merge pull request #1424 from cfromknecht/btcutil-update-bug-optimization
build: update to latest version of btcutil
2019-04-25 18:14:20 -07:00
Olaoluwa Osuntokun
b8cdcc3ffc
build: update to latest version of btcutil
In this commit, we update to the latest version of btcutil which
contains a bug fix for filter matching, and as optimizations speed up
both filter matching and constructions.
2019-04-25 17:38:31 -07:00
Olaoluwa Osuntokun
150379531e
Merge pull request #1418 from cfromknecht/useragent-white-blacklist
Configurable UserAgent filtering
2019-04-24 16:49:38 -07:00
Olaoluwa Osuntokun
8bb9c0b392
Merge pull request #1416 from cfromknecht/prioritize-higher-sync-peer
netsync/manager: prioritize higher height peers for sync peer
2019-04-24 16:21:41 -07:00
Olaoluwa Osuntokun
6867ff3278
Merge pull request #1420 from cfromknecht/moar-ckpts
chaincfg: update checkpoints
2019-04-18 16:24:30 -07:00
Olaoluwa Osuntokun
3fbc9997ce
chaincfg: update testnet checkpoints 2019-04-17 15:33:09 -07:00
Olaoluwa Osuntokun
778c28fcd8
chaincfg: update mainnet checkpoints 2019-04-17 15:33:09 -07:00
Conner Fromknecht
39592eba78
btcd: pass user agent black and white lists to server 2019-04-16 21:31:08 -07:00
Conner Fromknecht
a9f23321d9
netsync/manager: prioritize higher height peers for sync peer
This commit modifies the sync peer selection to prefer peers with a
higher advertised height than our currently known best height. If no
peers are known with a higher height, we will fall back to selecting a
random peer with the same best height as our own.

The current algorithm currently selects a random peer from the union of
these two sets, while this approach will favor trying to make progress.
This will likely help in selecting a good peer once already at tip, such
as after a restart.

Backport of https://github.com/gcash/bchd/pull/96
2019-04-16 21:09:18 -07:00
Conner Fromknecht
0e073b8058
config: adds AgentWhitelist and AgentBlacklist to config 2019-04-15 17:46:08 -07:00
Conner Fromknecht
d3ecdc91a9
server: adds hybrid black/whitelist filtering to user agents 2019-04-15 17:46:08 -07:00
Roei Erez
9bfb2ca034 connmgr: check for canceled connection before connect
This will ensure cancelation is reliable for all cases.
2019-04-09 19:54:18 -07:00
Mawueli Kofi Adzoe
aa6e0f3570 docs: use go modules instead of glide
Fixes https://github.com/btcsuite/btcd/issues/1379
2019-03-15 13:16:42 -07:00
Olaoluwa Osuntokun
306aecffea
Merge pull request #1391 from Roasbeef/btcutil-filter-fix
build: update to latest version of btcutil
2019-02-12 18:52:34 -08:00
Olaoluwa Osuntokun
2bdd957fe1
build: update to latest version of btcutil
In this commit, we update to the latest version of `btcutil`. This version
contains a bug fix for the neutrino filter generation. The implementation
within `btcutil` didn't fully comply with the BIP specification as it
included some OP_RETURN outputs, rather than excluding them all. As a
result, any active `btcd` node on mainnet/testnet will need to _drop their
entire `cfindex`_ and re-index after this is merged in.
2019-02-12 18:36:55 -08:00
Olaoluwa Osuntokun
12ce2fc7d3
Merge pull request #1383 from wpaulino/addrmgr-service-bits
addrmgr: store address' supported service bits
2019-02-08 16:00:34 -08:00
Wilmer Paulino
bcd50ea838
addrmgr: store address' supported service bits
In this commit, we update the serialized version of the AddressManager
to also store each address' service bits. This allows an address'
service bits to be properly set when read from disk, which allows
external callers to reliably filter out addresses which do not support
their required services.

Since the service bits were not previously stored, the serialization
version needed to be bumped. A test has been added to test the behavior
of upgrading from version 1 to 2.
2019-02-06 13:33:18 -08:00
Wilmer Paulino
10f17a8bb0
addrmgr: add AddrManager serialization test 2019-02-06 13:33:11 -08:00
Wilmer Paulino
18a6867124
addrmgr/knownaddress: expose an address' service bits 2019-02-06 13:33:11 -08:00
Olaoluwa Osuntokun
ed77733ec0
Merge pull request #1359 from wpaulino/rescan-script-spends
txscript+rpcwebsocket: detect script spend within rescans
2019-01-14 17:39:29 -08:00
Wilmer Paulino
f6eae62a77
rpcwebsocket: detect and notify spend of script
In this commit, we modify the rescanBlock method to also determine
whether a script (encoded as an address in its rescanKeys) has been
spent. Upon detecting a spend, a btcjson.RedeemingTxNtfn is sent to the
client who requested it.
2019-01-11 18:30:42 -08:00
Wilmer Paulino
be2b6dc98a
rpcwebsocket: modify rescanKeys to take addresses as strings
In this commit, we modify the rescanKeys struct, which contains the
relevant keys that should be matched when rescanning the chain, to take
addresses in their string representation. This ends up simplifying a lot
of the logic as we no longer have to special-case specific script types.
2019-01-11 18:30:42 -08:00
Wilmer Paulino
0cec774a75
txscript: add support to re-derive output's PkScript from input
In this commit, we extend the txscript package to support re-deriving
the PkScript of an output by looking at the input's signature
script/witness attempting to spend it. As of this commit, the only
supported types are P2SH, v0 P2WSH, and v0 P2WPKH.

This will serve useful to detect when a particular script has been spent
on-chain.

A set of test vectors has also been added for the supported script types
to ensure its correctness.
2019-01-11 18:30:42 -08:00
Shuai Qi
5bda5314ca netsync+blockchain: fix typos 2019-01-08 20:07:09 -08:00
Olaoluwa Osuntokun
cfcc5e0305
Merge pull request #1355 from cfromknecht/tidy-go-mod
build: tidy go modules
2019-01-08 20:02:48 -08:00
Conner Fromknecht
2ecf0619f2
build: tidy go modules 2018-11-30 13:52:58 -08:00
Olaoluwa Osuntokun
7d2daa5bfe
Merge pull request #1354 from cfromknecht/go-modules
build: Migrate to go modules
2018-11-29 17:59:35 -08:00
Conner Fromknecht
20388be196
README: require go1.11, document module installation 2018-11-29 17:53:41 -08:00
Conner Fromknecht
2f3be2e337
travis: remove glide, only build 1.11.x, use modules 2018-11-29 17:51:22 -08:00
Conner Fromknecht
2a9e4372c8
goclean: update for go modules 2018-11-29 17:45:40 -08:00
Conner Fromknecht
97c3fea94c
build: remove glide.lock and glide.yaml 2018-11-29 17:38:24 -08:00
Conner Fromknecht
852b39bd6d
build: add go.mod and go.sum for 1.11 modules 2018-11-29 17:34:23 -08:00
Olaoluwa Osuntokun
b6c71b40a8
Merge pull request #1352 from halseth/import-path-rpctest
integration/rpctest: make exec path compatible with modules
2018-11-29 14:56:06 -08:00
Johan T. Halseth
f5b60801a5
integration/rpctest: make exec path compatible with modules
With the use of go modules, the btcdPkgPath will no longer be `github.com/btcsuite/btcd`, but end with a version string (e.g. btcd@v0.0.0-20181129140220-beb77e89572a).

This trips up build.ImportDir, which will return a ImportPath of ".", since this package cannot be found in the go path.

There are probably several ways of fixing this, by clever string magic, but seems easiest to just hardcode the btcd package name.
2018-11-29 15:13:37 +01:00
junderw
3dcf298fed Fix one-off bug in signRFC6979 2018-11-23 13:02:23 -06:00
Olaoluwa Osuntokun
67e573d211
Merge pull request #1310 from sangaman/patch-1
sampleconfig: Remove floating grave accent
2018-10-12 17:44:28 -07:00
Olaoluwa Osuntokun
1c5c32a5e8
Merge pull request #1315 from halseth/msgcfilter-string
peer log: add MsgCFHeaders and MsgGetCFHeaders message summary
2018-10-12 17:43:50 -07:00
Olaoluwa Osuntokun
5f1bfdec9a
Merge pull request #1316 from halseth/connmgr-nil-addr
connmanager: check Addr for nil
2018-10-12 17:43:14 -07:00
Olaoluwa Osuntokun
d2b1a06d93
Merge pull request #1129 from gracenoah/fix-rescan
fix NewImportAddressCmd rescan wrong parameters
2018-10-12 17:34:25 -07:00
Olaoluwa Osuntokun
d2046eeb1b
Merge pull request #1256 from davecgh/server_onversion_use_local_for_net_addr
server: Use local addr var in version handler.
2018-10-12 17:27:28 -07:00
Johan T. Halseth
4b5ff8c687
connmanager: check Addr for nil 2018-10-01 13:55:43 +02:00
Johan T. Halseth
5e578f546f
peer log: add MsgCFHeaders and MsgGetCFHeaders string representation 2018-10-01 13:40:45 +02:00