Commit graph

3461 commits

Author SHA1 Message Date
pengyonghui
d590f3f77d fix typo 2021-10-26 09:56:57 -04:00
Jonathan Chappelow
a148fa797a addrmgr: make KnownAddress methods thread-safe
This gives KnownAddress a sync.RWMutex so the exported methods may
safely access the na (*wire.NetAddress) and lastattempt fields.
The AddrManager is updated to lock the new KnownAddress mutex before
assigning to na or lastattempt.
The other KnownAddress fields are only accessed by AddrManager, using
its own Mutex for synchronization.
2021-10-26 09:55:49 -04:00
Olaoluwa Osuntokun
e3449998be
Merge pull request #1752 from Roasbeef/config-disable-stall-handler
peer+server: add new config option to optionally disable stall detection
2021-10-05 11:44:31 -07:00
Olaoluwa Osuntokun
e98a1a1b4c
peer+server: add new config option to optionally disable stall detection
In this commit, we add a new config options that allows one to start
`btcd` in an operating mode that disables the stall detection. This can
be useful in simnet/regtest integration tests settings where it's
important that `btcd` holds on to its possibly sole connection to the
only other node in the test harness.

A new config flag has been added to gate this behavior, which is off by
default.
2021-10-01 14:55:50 -07:00
naveen
4caf037c52 Upgraded the docker version to 1.16
With this changes https://github.com/btcsuite/btcd/pull/1753/ merged in
the docker image also has to be upgraded.
2021-09-17 11:17:29 -04:00
Olaoluwa Osuntokun
bca4298ada
Merge pull request #1753 from Roasbeef/bump-go-version
build: bump min Go version to 1.16.8 add Go 1.17.1
2021-09-16 14:32:45 -07:00
eugene
f8e6854197 mempool: introduce GetDustThreshold to export dust limit calculation
This commit modifies no behavior and would allow other projects to
retrieve the dust limit for a particular output type before the
amount of the output is known. This is particularly useful in the
Lightning Network for channel negotiation.
2021-09-16 15:17:17 -04:00
Olaoluwa Osuntokun
7ae5b74dee
build: bump min Go version to 1.16.8 add Go 1.17.1 2021-09-15 18:19:34 -07:00
Marius van der Wijden
5e6736aad5 btcec: added testcase for point at infinity 2021-09-13 15:59:28 -04:00
Marius van der Wijden
73f7eac903 btcec: check if recovered pk is at point of infinity 2021-09-13 15:59:28 -04:00
JeremyRand
3e2d8464f1
rpcclient: Export symbols needed for custom commands (#1457)
* rpcclient: Export sendCmd and response

This facilitates using custom commands with rpcclient.

See https://github.com/btcsuite/btcd/issues/1083

* rpcclient: Export receiveFuture

This facilitates using custom commands with rpcclient.

See https://github.com/btcsuite/btcd/issues/1083

* rpcclient: Add customcommand example

* rpcclient: remove "Namecoin" from customcommand readme heading
2021-09-02 08:39:55 +02:00
John C. Vernaleo
f9d72f05a4 Switch irc to libera.chat 2021-08-31 07:50:29 -04:00
eugene
f5a1fb9965 mempool: export isDust for use in other projects
This changes isDust to IsDust so other golang projects (btcwallet
or lnd) can use the precise dust calculation used by btcd.
2021-08-03 09:34:49 -04:00
Calvin Kim
b3e6bd6161 rpcserverhelp: Remove extra period for gettxout--synopsis 2021-07-27 10:27:50 -04:00
Anirudha Bose
86a17263b0
Merge pull request #1729 from gnasr/fix-psbtopts-feerate-type
btcjson: Update WalletCreateFundedPsbtOpts.FeeRate type
2021-06-25 21:49:46 +02:00
Gabriel Nasr
505915dc3f btcjson: Update WalletCreateFundedPsbtOpts.FeeRate from *int64 to *float64 2021-06-25 15:23:44 -03:00
Anirudha Bose
63438c6d36 Update release date for v0.22.0-beta in CHANGES file 2021-06-01 13:16:51 -04:00
John C. Vernaleo
aaf19b26f3 btcd: bump version to v0.22.0-beta 2021-06-01 09:36:33 -04:00
Anirudha Bose
418f9204f4 Update CHANGES file for 0.22.0 release 2021-05-26 09:54:22 -04:00
Olaoluwa Osuntokun
ee5896bad5 mempool: add additional test case for inherited RBF replacement
In this commit, we add an additional test case for inherited RBF
replacement. This test case asserts that if a parent is marked as being
replaceable, but the child isn't, then the child can still be replaced
as according to BIP 125 it shoudl _inhreit_ the replaceability of its
parent.

The addition of this test case was prompted by the recently discovered
Bitcoin Core "CVE" [1]. It turns out that bitcoind doesn't properly
implement BIP 125. Namely it fails to allow a child to "inherit"
replaceability if its parent is also replaceable. Our implementation
makes this trait rather explicit due to its recursive implementation.
Kudos to the original implementer @wpaulino for getting this correct.

[1]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-May/018893.html.
2021-05-13 10:15:27 -04:00
Oliver Gugger
7b6c2b3423 chaincfg: fix deployment bit numbers
On signet all previous soft forks and also taproot are always activated,
meaning the version is always 0x20000000 for all blocks. To make sure
they activate properly in `btcd` we therefore need to use the correct
bit to mask the version.
This means that on any custom signet there would need to be 2016 blocks
mined before SegWit or Taproot can be used.
2021-05-11 15:55:06 -04:00
John C. Vernaleo
0ec4bdc1b8 Don't reference the readme that we don't produce 2021-05-06 18:51:45 -04:00
Olaoluwa Osuntokun
ce697fe7e8
Merge pull request #1716 from halseth/witness-commitment-rpctest
rpctest: add witness commitment when calling CreateBlock
2021-04-29 15:55:35 -07:00
Olaoluwa Osuntokun
7eba688b65
Merge pull request #1692 from guggero/signet
wire+chaincfg: add signet params
2021-04-26 11:01:13 -07:00
Johan T. Halseth
37a6e8485b
rpctest: add witness commitment when calling CreateBlock
If we tried to include transactions having witnesses, the block would be
invalid since the witness commitment was not added.
2021-04-26 13:53:53 +02:00
Johan T. Halseth
f0f4784c1c
mining: extract witness commitment add into method 2021-04-26 13:53:22 +02:00
Oliver Gugger
7d1ab0b4d7
btcctl: add signet param
This commit adds the --signet command line flag to the btcctl utility.
2021-04-22 13:10:45 +02:00
Oliver Gugger
8a62cf0ef5
rpcserver: add taproot deployment to getblockchaininfo 2021-04-22 13:10:45 +02:00
Oliver Gugger
3eac153437
config+params: add signet config option
This commit adds the --signet command line flag (or signet config
option) for starting btcd in signet mode.
2021-04-22 13:10:45 +02:00
Oliver Gugger
73ecb5997b
wire+chaincfg: add signet params
This commit adds all necessary chain parameters for connecting to the
public signet network.
Reference: https://github.com/bitcoin/bitcoin/pull/18267
2021-04-22 13:10:44 +02:00
Aurèle Oulès
2d7825cf70 btcjson: Updated TxRawResult.Version from int32 to uint32 2021-04-13 15:21:09 -04:00
Jake Sylvestre
540786fda6 rpcclient: fix documentation typo 2021-04-13 09:09:20 -04:00
Olaoluwa Osuntokun
36a96f6a00
Merge pull request #1704 from wpaulino/update-btcutil
build: update btcutil dependency
2021-03-31 18:33:23 -07:00
Wilmer Paulino
f133593b93
build: update btcutil dependency 2021-03-29 16:59:44 -07:00
Gustavo Chain
f86ae60936 addrmgr: Use RLock/RUnlock when possible 2021-03-16 13:24:10 -04:00
Olaoluwa Osuntokun
01c6a6fe9b
Merge pull request #1698 from wpaulino/external-peer-testing
peer: allow external testing of peer.Peer
2021-03-12 16:28:45 -08:00
Wilmer Paulino
fdb479f121
peer: allow external testing of peer.Peer
The previous use of allowSelfConns prevented this, as users aren't able
to invoke peer.TstAllowSelfConns themselves due to being part of a test
file, which aren't exported at the library level, leading to a
"disconnecting peer connected to self" error upon establishing a mock
connection between two peers. By including the option at the config
level instead (false by default, prevents connections to self) we enable
users of the peer library to properly test the behavior of the peer.Peer
struct externally.
2021-03-11 18:24:13 -08:00
Gustavo Chain
556620fea6 rpcserver: Fix Error message returned by processRequest
When processRequest can't find a rpc command, standardCmdResult returns
a `btcjson.ErrRPCMethodNotFound` but it gets ignored and a
`btcjson.ErrRPCInvalidRequest` is returned instead.

This makes processRequest return the right error message.
2021-03-09 10:34:32 -05:00
Jake Sylvestre
d08785547a docs: update shields 2021-03-05 07:45:19 -05:00
Appelberg-s
dff2198fc5 Fix error message returned by EstimateFee
When you provide an argument to EstimateFee(numblocks uint32) that exceeds the estimateFeeDepth (which is set to 25), you get an error message that says "can only estimate fees for up to 100 blocks from now".  The variable used in the if condition and the variable used for creating the error message should be the same.
2021-02-09 09:54:33 -05:00
Jake Sylvestre
2a1aa5129e Add Batch JSON-RPC support (rpc client & server) 2021-02-09 09:47:46 -05:00
Anirudha Bose
31b66488b4 btcec: validate R and S signature components in RecoverCompact 2021-02-09 09:43:01 -05:00
Olaoluwa Osuntokun
fa683a69dc
Merge pull request #1689 from cfromknecht/hashcache-flake
txscript/hashcache_test: fix flake due to resetting RNG
2021-02-03 19:32:39 -08:00
Conner Fromknecht
5300a19d06
txscript/hashcache_test: call rand.Seed once in init
This resolves the more fundamental flake in the unit tests noted in the
prior commit.

Because multiple unit tests call rand.Seed in parallel, it's possible
they can be executed with the same unix timestamp (in seconds). If the
second call happens between generating the hash cache and checking that
the cache doesn't contain a random txn, the random transaction is in
fact a duplicate of one generated earlier since the RNG state was reset.

To remedy, we initialize rand.Seed once in the init function.
2021-02-02 13:31:47 -08:00
Conner Fromknecht
1dd693480c
txscript/hashcache_test: always add inputs during getTxn
TestHashCacheAddContainsHashes flakes fairly regularly when rebasing
PR #1684 with:
    txid <txid> wasn't inserted into cache but was found.

With probabilty 1/10^2 there will be no inputs on the transaction. This
reduces the entropy in the txid, and I belive is the primary cause of
the flake.
2021-02-02 12:44:22 -08:00
Dan Cline
77fd96753c txscript: add benchmark for IsUnspendable
- create benchmarks to measure allocations
 - add test for benchmark input
 - create a low alloc parseScriptTemplate
 - refactor parsing logic for a single opcode
2021-02-02 09:20:31 -05:00
Steven Kreuzer
7bbd9b0284 btcjson: Update fields in GetBlockChainInfoResult
Update the fields of GetBlockChainInfoResult to reflect the current state of
the RPC returned by other full-node implementations.

 * InitialBlockDownload - Node is in Initial Block Download mode if True.
 * SizeOnDisk - The estimated size of the block and undo files on disk.
2021-01-26 09:52:38 -05:00
Vinayak Borkar
c3ece697da Fixes btcsuite/btcd#1653 2021-01-18 13:51:45 -05:00
Victor Lavaud
e747eb9284 Add support for arm32v7 in Dockerfile 2021-01-18 13:50:30 -05:00
ebiiim
12abc84cb2 fixed broken link 2021-01-18 13:48:02 -05:00