Commit graph

3459 commits

Author SHA1 Message Date
jalavosus
57cb8e4b11 Refactor FutureGetBlockVerboseResult into two types: FutureGetBlockVerboseResult, and FutureGetBlockVerboseTxResult.
Due to differences in how getblock returns data based on the provided verbosity parameter, it's necessary
to have two separate return types based on verbosity. This necessitates a separate unmarshalling function
(represented throughout rpcclient/chain.go as Result.Receive()) to ensure that data is correctly unmarshalled
and returned to the user.
2020-03-05 06:48:19 -05:00
jalavosus
468154a052 Refactor GetBlockVerboseResult into two separate types: one type for getblock "hash" verbosity=1,
and a second type for getblock "hash" verbosity=2. This is necessary due to how getblock returns
a block's transaction data based on the provided verbosity parameter.

If verbosity=1, then getblock.Tx is an array of a block's transaction ids (txids) as strings.
If verbosity=2, then getblock.Tx is an array of raw transaction data.
2020-03-05 06:47:38 -05:00
jalavosus
160c388285 Refactor GetBlockCmd type and NewGetBlockCmd() function to follow the bitcoin json RPC verbosity format for getblock,
which uses 0, 1, or 2 as parameters rather than a boolean true or false.
2020-03-05 06:47:38 -05:00
Kulpreet Singh
06e5c43499 Add note about using gencerts when listening on specific interfaces 2020-03-04 10:10:03 -05:00
mohanson
e2c08cc80b docs/json_rpc_api: update go examples 2020-03-04 10:06:41 -05:00
qshuai
ef4cecf42b blockchain/indexers: Start a new line for long code 2020-03-04 09:42:00 -05:00
shuai.qi
46461dc84a btcjson, rpclient: Fix typo 2020-03-04 09:23:11 -05:00
Yash Bhutwala
318c89dfed fix comment of database.Tx to match code 2020-03-04 09:21:27 -05:00
Nisen
0c76fbd26f Fix comment error 2020-03-04 08:40:20 -05:00
George Tankersley
8bbbe98be9 peer: fix small typo 2020-03-04 08:38:26 -05:00
Henry Harder
1639d6c070 release: add missing back tick in build docs 2020-03-04 08:16:36 -05:00
Federico Bond
3eb4739b75 Fix minRelayTxFee name in comment 2020-03-03 15:45:34 -05:00
Jake Sylvestre
eed57cdcf1 go fmt 2020-03-03 15:34:38 -05:00
John C. Vernaleo
c01c98159b
Merge pull request #1537 from jakesyl/patch-1
Remove $GOPATH Caching
2020-03-03 10:08:31 -05:00
Jake
6799104157
Remove $GOPATH Caching
$GOPATH caching has led to flaky tests as per #1503 and #1536. The speedup is marginal and while the false negatives are a headache, false positives are potentially dangerous.
2020-02-10 14:16:11 -05:00
Olaoluwa Osuntokun
f3ec13030e
btcd: bump version to v0.20.1-beta 2019-11-12 18:27:49 -08:00
Olaoluwa Osuntokun
037489ef50
Merge pull request #1485 from wpaulino/syncmanager-done-peer-verack
server: remove peer from SyncManager on VerAckReceived
2019-11-08 18:21:37 -08:00
Olaoluwa Osuntokun
79943b2331
Merge pull request #1488 from Crypt-iQ/server_race_1108
server: add addressesMtx to fix race condition
2019-11-08 18:21:10 -08:00
Olaoluwa Osuntokun
4eac390191
Merge pull request #1484 from wpaulino/bitcoind-0.19-compat
btcjson+rpcclient: add compatibility for bitcoind v0.19.0
2019-11-08 18:19:43 -08:00
nsa
c2ca0a408e
server: add addressesMtx to fix race condition 2019-11-08 21:11:24 -05:00
Wilmer Paulino
e2e5cc694d
btcjson+rpcclient: support new bitcoind sendrawtransaction request 2019-11-08 17:53:46 -08:00
Wilmer Paulino
93a84aa014
btcjson: use correct json tag for Bip9SoftForkDescription.StartTime 2019-11-08 17:53:45 -08:00
Wilmer Paulino
266851e329
btcjson+rpcclient: support new unified softfork bitcoind format 2019-11-05 16:28:33 -08:00
Wilmer Paulino
e89d4fca24
rpcclient: allow retrieval of backend version 2019-11-04 17:44:29 -08:00
Wilmer Paulino
bc21593480
server: remove peer from SyncManager on VerAckReceived
Peers are now added to the SyncManager if we receive their verack, but
we'd still attempt to remove them from the SyncManager if we didn't
receive it.
2019-10-29 19:38:38 -07:00
Wilmer Paulino
a46f7b45ab
rpcclient: add GetNetworkInfo method 2019-10-29 18:49:37 -07:00
Olaoluwa Osuntokun
a41498d578
release: remove windows-arm 2019-10-15 10:11:03 +02:00
Olaoluwa Osuntokun
2fb0deccfd
Merge pull request #1478 from Roasbeef/release-0.20.0
btcd: prep for upcoming btcd release
2019-10-14 17:36:16 +02:00
Olaoluwa Osuntokun
860ca32a22
Merge pull request #1480 from wpaulino/add-peer-on-verack
server: refactor OnVersion to instead add peers within OnVerAck
2019-10-14 17:11:47 +02:00
Wilmer Paulino
baeb789a7d
server: prevent adding peers if already disconnected
This addresses an issue where the server ends up tracking a peer that
has been disconnected due to it processing a peer's `done` message
before its `add` message.
2019-10-14 13:26:44 +02:00
Wilmer Paulino
769c4e152f
server: request addresses from new peers once they can process messages
This was previously done within the OnVersion listener, which should not
be a blocking operation. It turns out that requesting these messages
there can lead to blocking due to peers not being able to process
messages since their message queues have yet to start. Therefore, we'll
now request within handleAddPeerMsg, which should allow it to go
through.
2019-10-14 13:26:43 +02:00
Wilmer Paulino
a1a5bfa819
server: add new peers within OnVerAck instead of within OnVersion
This change is needed as part of requiring peers to also send a verack
message following their version message during protocol negotiation.
Peers were previously added to the SyncManager before their message
queues were started, causing the server to stall if a peer didn't
provide a timely verack response following their version. We now do this
within OnVerAck, which happens shortly before peer message queues are
started.
2019-10-14 13:26:42 +02:00
Wilmer Paulino
11b84f5cb5
server: signal SyncManager with new peer within AddPeer
This makes the logic a bit more unified as previously it was possible we
for us to report the new peer to the SyncManager, but for whatever
reason failed to track the peer in the server internally within AddPeer.
This change ensures this can no longer happen.
2019-10-14 13:26:16 +02:00
Olaoluwa Osuntokun
07282a6656
Merge pull request #1477 from wpaulino/conn-fixes
server: miscellaneous connection management fixes
2019-10-11 16:14:09 -07:00
Olaoluwa Osuntokun
c3151ef50d
Merge pull request #1479 from cfromknecht/normalize-decompress
btcec/pubkey: normalize sqrt(x^3) before checking parity
2019-10-10 21:21:31 -07:00
Conner Fromknecht
069ec701df
btcec/pubkey: normalize sqrt(x^3) before checking parity
This commit fixes an issue introduced in the recent #1429, where
the output of SqrtVal is not normalized before using IsOdd() to compare
with the expected parity of the y-coordinate. The IsOdd() is only
guaranteed to work if the value has been denormalized, so a denormalized
sqrt >= p would report the opposite parity. We fix this by normalizing
both after compute sqrt(x^3) and when negating the root as directed by
the ybit.
2019-10-10 18:07:37 -07:00
Olaoluwa Osuntokun
2083acdd24
release: add new release script and documentation
In this commit, we add the new release script that will be used to build
all release binaries going forward. We also remove the existing
Conformal key as it's no longer in use, updating the README to reflect
the new release build/verification process.
2019-10-10 16:18:02 -07:00
Wilmer Paulino
0d00cdf82c
server: request new peer after disconnection of non-persistent peers
Doing so ensures we reach our target number of outbound peers as soon as
possible. This is only necessary after calls to connmgr.Remove, as these
won't request a new peer connection.
2019-10-10 19:05:41 -04:00
Wilmer Paulino
45d66d46f9
server: standardize use of connmanager's Disconnect and Remove methods
The Disconnect method would still attempt to reconnect to the same
peer, which could cause us to reconnect to bad/unstable peers if we came
across them. Instead, we'll now use Remove whenever we intend to remove
a peer that is not persistent.
2019-10-10 19:05:37 -04:00
Olaoluwa Osuntokun
e47518c978
btcd: bump version to v0.20.0-beta 2019-10-10 15:54:11 -07:00
Wilmer Paulino
ab6f3089f6
server: mark address as connected within handleAddPeerMsg
We do this to ensure the address manager contains live addresses.
Previously, addresses with which we established connections with would
not be marked as connected because it would be done once we disconnect
peers. Given that we don't process all of the disconnect logic when
we're shutting down, addresses of stable and good peers would never be
marked as connected unless the connection was lost during operation.
2019-10-10 12:10:52 -04:00
Wilmer Paulino
06baabe5da
server: mark address attempted on attempt rather than upon connection
We should mark addresses as attempted when we attempt to connect to
them, not once we establish a connection with said address.
2019-10-10 12:03:47 -04:00
Olaoluwa Osuntokun
988181ef23
Merge pull request #1472 from wpaulino/go1.13
build: use go 1.13.x in travis
2019-10-09 18:10:42 -07:00
Olaoluwa Osuntokun
b686b0a8eb
Merge pull request #1429 from cfromknecht/btcec-double-is-on-curve
btcec: optimize square root using fieldVal
2019-10-09 17:54:42 -07:00
Conner Fromknecht
2340ad388c
btcec/btcec: deprecate QPlus1Div4() in favor of Q()
The previous naming suggested that the value ((P+1)/4+1)/4 was being
returned, when in fact the returned value is simply (P+1)/4. The old
method is superseded by Q().
2019-10-02 18:22:17 -07:00
Conner Fromknecht
c7d523f83c
btcec/pubkey: optimize decompressPoint using fieldVals
This commit optimizes the decompressPoint subroutine, used in extracting
compressed pubkeys and performing pubkey recovery. We do so by replacing
the use of big.Int.Exp with with square-and-multiply exponentiation of
btcec's more optimized fieldVals, reducing the overall latency and
memory requirements of decompressPoint.

Instead of operating on bits of Q = (P+1)/4, the exponentiation applies
the square-and-multiply operations on full bytes of Q.  Compared to the
original speedup. Compared the bit-wise version, the improvement is
roughly 10%.

A new pair fieldVal methods called Sqrt and SqrtVal are added, which
applies the square-and-multiply exponentiation using precomputed
byte-slice of the value Q.

Comparison against big.Int sqrt and SAM sqrt over bytes of Q:

benchmark                            old ns/op     new ns/op     delta
BenchmarkParseCompressedPubKey-8     35545         23119         -34.96%

benchmark                            old allocs     new allocs     delta
BenchmarkParseCompressedPubKey-8     35             6            -82.86%

benchmark                            old bytes     new bytes     delta
BenchmarkParseCompressedPubKey-8     2777          256           -90.78%
2019-10-02 18:21:59 -07:00
Conner Fromknecht
39500ed5ed
btcec/pubkey: remove redundant checks from compressed pubkey parsing
As of https://github.com/btcsuite/btcd/pull/1193, decompressPoint now
validates that the point is on the curve. The x and y cooordinates are
also implicitly <= P, since the modular reduction is applied to both
before the method returns. The checks are moved so that they are still
applied when parsing an uncompressed pubkey, as the checks are not
redundant in that path.
2019-10-02 15:31:23 -07:00
Conner Fromknecht
4aeb189fc4
btcec: benchmark ParsePubKey for compressed keys 2019-10-02 15:31:23 -07:00
Olaoluwa Osuntokun
e159f05c6e
build: use go 1.13.x in travis 2019-09-25 18:43:43 -07:00
Sad Pencil
ba530c4abb btcec: correct the comment of recoverKeyFromSignature 2019-09-25 17:28:57 -07:00