Commit graph

3357 commits

Author SHA1 Message Date
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
Daniel McNally
93fa810723
sampleconfig: Remove floating grave accent 2018-09-27 12:41:34 -04:00
Olaoluwa Osuntokun
2a560b2036
Merge pull request #1301 from meyer9/fix-sig-dos
btcec/signature: fix DoS bug with signature parsing
2018-09-23 19:12:09 -07:00
Dave Collins
8c981e4ef2
server: Use local addr var in version handler.
This modifies the OnVersion handler for server peers to use a local
variable for the remote address of the peer in order to avoid grabbing
the mutex multiple times.

There are no functional changes.

Backported from Decred.
2018-09-20 22:32:59 -05:00
Dave Collins
c8b9fab820
server: Only advertise local addr when current.
This changes the server peers OnVersion handler to only advertise the
server as a viable target for inbound connections when the server
believes it is close the best known tip.

Backported from Decred.
2018-09-20 22:32:41 -05:00
Dave Collins
d2c7892aa4
server: Use local inbound var in version handler.
This modifies the OnVersion handler for server peers to use a local
variable for the inbound status of the peer in order to avoid grabbing
the mutex multiple times.

While here, it also does some light cleanup.  There are no functional
changes.

Backported from Decred.
2018-09-20 22:32:16 -05:00
Dave Collins
4b20d4f86a
server: Update addrmgr services on outbound conns.
This adds code to update the address manager services for a known
address to the services advertised by peers when they are connected to
via an outbound connection.  It is only done for outbound connections to
help prevent malicious behavior from inbound connections.

Backported from Decred.
2018-09-20 22:31:50 -05:00
Dave Collins
24e23525fb
addrmgr: Expose method to update services.
This exposes a new method named SetServices to the address manager which
can be used to update the services for a known address.  This will be
useful to keep known services up to date.

Backported from Decred.
2018-09-20 22:31:49 -05:00
Dave Collins
4d1e1db9ea
peer: Improve net address service adverts.
This modifies the peer code which deals with advertising service flags
via the net address fields of the version message as follows:

- For outgoing connections:
  - Set the local netaddress services to what the local peer supports
  - Set the remote netaddress services to 0 to indicate no services as
    they are still unknown
- For incoming connections:
  - Set the local netaddress services to what the local peer supports
  - Set the remote netaddress services to the what was advertised by the
    remote peer in its version message
2018-09-20 22:31:23 -05:00
Dave Collins
9151ebc90b
server: Reject outbound conns to non-full nodes.
This modifies the server connection code to reject outbound peers that
do not offer full node services.
2018-09-20 22:30:46 -05:00
Dave Collins
7b103e2434
peer: Allow OnVersion callback to reject peer.
This modifies the OnVersion callback to allow a reject message to be
returned in which case the message will be sent to the peer and the peer
will be disconnected.

Backported from Decred.
2018-09-20 22:29:27 -05:00
Dave Collins
118f55233b
peer: Rework version negotiation.
This modifies the negotiation logic to ensure the callback has the
opportunity to see the message before the peer is disconnected and
improves the error handling when reading the remote version message.

It also has the side effect of ensuring the protocol version is
negotiated before sending reject messages with the exception of the
first message not being a version message since negotiation is not
possible in that case.

This is being changed because it is useful for the server to see the
message regardless in order to have the opportunity to things such as
update the address manager and reject peers that don't have desired
services.

Backported from Decred.
2018-09-20 22:26:36 -05:00
Julian Meyer
66d33037ec btcec/signature: updated comment to reference constant instead of value 2018-09-20 20:24:03 -07:00
Julian Meyer
8965887ca4 btcec/signature: moved minimum signature length to a constant 2018-09-20 20:19:11 -07:00
Dave Collins
25dfda9bd3
peer: Add duplicate version message test.
This adds a test to ensure duplicate version messages are rejected.

Backported from Decred.
2018-09-20 22:18:36 -05:00
Olaoluwa Osuntokun
92494a5188
Merge pull request #1282 from qshuai/master
server: Fix struct name mismatch
2018-09-20 20:16:19 -07:00
Olaoluwa Osuntokun
934137b22a
Merge pull request #1217 from halseth/node-command-btcsuite
rpcclient: expose the Node command for RPC API.
2018-09-20 20:14:26 -07:00
Olaoluwa Osuntokun
7e475a7259
Merge pull request #1267 from davecgh/txscript_backport_sigencoding_updates
txscript: Cleanup strict signature enforcement.
2018-09-20 20:12:35 -07:00
Julian Meyer
db8e412dc6 btcec/signature: fix DoS bug with signature parsing 2018-09-20 09:26:45 -07:00
qshuai
badf5453e9 server: Fix struct name mismatch 2018-09-08 22:34:41 +08:00
Johan T. Halseth
085a2b96e9
rpcclient: expose the Node command for RPC API. 2018-09-04 09:40:08 +02:00
Olaoluwa Osuntokun
cff30e1d23
Merge pull request #1277 from halseth/cf-checkpoint-rlock
server: allow for read concurrency when serving cf checkpoints, fix bug in checkpoint serving
2018-09-03 16:29:27 -07:00
Olaoluwa Osuntokun
222a6dac0d
server: fix panic bug when looking for cf checkpoint cache intersection w/ chain
In this commit, we fix a panic bug that can arise when we attempt to
process a cf checkpoint message from a remote peer. Before this commit,
if the size of the checkpoint cache was large than the number of
checkpoints requested by the peer, we would panic with an out of bounds
error. In order to prevent, this we'll now use the size of the requested
set of hashes as our bound to ensure that we don't panic.
2018-08-27 17:49:45 -07:00
Olaoluwa Osuntokun
c8e6363e22
server: modify locking in OnGetCFCheckpt to allow for read concurrency
In this commit, we modify the locking scheme when serving cf checkpoints
for peers to allow the server to serve multiple peers at the same time.
Before this commit, we would first grab the write lock, check to see for
expansion, then release the read lock. In this commit we reverse this
and instead will grab the read lock, and upgrade to the write lock if we
need to actually expand the size of the cache.
2018-08-27 17:46:41 -07:00
Olaoluwa Osuntokun
79e00513b1
Merge pull request #1268 from cfromknecht/enforce-default-trickle-interval
peer: Enforce default trickle interval
2018-08-23 23:44:22 -07:00
Conner Fromknecht
ae733e7291
server: switch TrickleTimeout -> TrickleInterval 2018-08-23 22:55:21 -07:00
Conner Fromknecht
eb8e117f86
config: use peer.DefaultTrickleInterval as default val 2018-08-23 22:55:21 -07:00
Conner Fromknecht
475eafdc70
peer/example_test: switch TrickleTimeout -> TrickleInterval 2018-08-23 22:55:21 -07:00
Conner Fromknecht
7b402cd63b
peer/peer_test: switch TrickleTimeout -> TrickleInterval 2018-08-23 22:55:21 -07:00
Conner Fromknecht
602bced5f5
peer/peer: switch TrickleTimeout -> TrickleInterval 2018-08-23 22:55:21 -07:00
Conner Fromknecht
7a657ffa2e
wire/msgcfcheckpt: add sanity check for cf checkpoint parsing 2018-08-23 22:55:20 -07:00
Conner Fromknecht
53d846d68c
glide: update lock w/ hash instead of semantic ver 2018-08-23 22:50:35 -07:00
Dave Collins
07edce81b0
txscript: Cleanup strict signature enforcement.
This cleans up the code for handling the checksig and checkmultisig
opcode strict signatures to explicitly call out any semantics that are
likely not obvious and improve readability.

It also introduce new distinct errors for each condition which can
result in a signature being rejected due to not following the strict
encoding requirements and updates reference test adaptor accordingly.
2018-08-23 11:56:28 -05:00
Olaoluwa Osuntokun
d81d8877b8
Merge pull request #1266 from cfromknecht/arm-siphash-fix
build: update siphash lib to latest version w/ ARM fix
2018-08-22 20:07:28 -07:00
Olaoluwa Osuntokun
e3a8d7fb29
Merge pull request #1265 from cfromknecht/fix-indexer-reorg
blockchain/indexers: fix bug in indexer re-org catch up
2018-08-22 20:07:08 -07:00
Olaoluwa Osuntokun
b36dce5032
build: update siphash lib to latest version w/ ARM fix
In this commit, we update the siphash lib we use to the latest version
as it was discovered that the assembly for certain ARM machines has a
flaw which causes it to compute an _incorrect_ siphash function. The
upstream lib has since disabled the assembly after this was discovered.
We update as well in order to ensure that ARM machines will produce the
proper GCS filters.
2018-08-22 19:58:59 -07:00
Olaoluwa Osuntokun
be191ca111
blockchain/indexers: fix bug in indexer re-org catch up
In this commit, we fix an existing bug in the re-org catch up logic for
the `IndexManager`. Before this commit, we would assign the block to the
_local_ scope rather than the outer scope. As a result, we would never
properly bisect the chain to find the fork point to be able to reconcile
the index state to the main chain only after a re-org occurs.

Fixes #1261
2018-08-22 19:46:27 -07:00
Olaoluwa Osuntokun
9d15e63c50
Merge pull request #1259 from cfromknecht/bhv-int64-confs
btcjson: use int64 for GetBlockHeader[Verbose] confirmations
2018-08-22 19:45:43 -07:00
Olaoluwa Osuntokun
9f436585d7
Merge pull request #1247 from davecgh/peer_minor_cleanup
peer: Minor function definition order cleanup.
2018-08-22 19:41:16 -07:00
Olaoluwa Osuntokun
8822e27134
Merge pull request #1223 from wpaulino/harness-disable-txindex
integration/rpctest: disable the txindex by default and allow sending txs without change outputs
2018-08-22 19:40:27 -07:00