Commit graph

4045 commits

Author SHA1 Message Date
Oliver Gugger
cefeeaa6b6
mod+rpcserver: bump to latest version of btcec 2024-07-23 10:57:08 +02:00
linghuying
ff2e03e112
chore: fix some comments for struct field (#2214)
Signed-off-by: linghuying <1599935829@qq.com>
2024-07-16 09:02:23 -04:00
Olaoluwa Osuntokun
2134387ba8
Merge pull request #2208 from kcalvinalvin/2024-07-01-close-blockfiles
ffldb: close block files
2024-07-12 16:55:03 -07:00
zhiqiangxu
e5d15fddb9
btcec/ecdsa: remove error return value for SignCompact (#2211) 2024-07-10 08:43:15 -04:00
Calvin Kim
c9fae1ac7c ffldb: close block files before deleting them
The block files may be open when deleteFile is called.  This resulted in
files not being deleted and erroring out on windows.  Properly closing
the files closing the files avoids this error.
2024-07-01 22:13:22 +09:00
Calvin Kim
8ed8ef1340 ffldb: refactor out file close code into its own method
The existing file close code is refactored out into it's own method
closeFile() so that it can be reused elsewhere.
2024-07-01 22:12:32 +09:00
Calvin Kim
8b5f2aa6f2 ffldb: add check for deleting files that are open
This check let's us ensure that attempting to delete open files are
caught during unit tests.
2024-07-01 22:12:32 +09:00
Calvin Kim
4712e20049 ffldb: throw error when attempting to delete an open file
This change lets us test that we don't attempt to delete open files with
unit tests.  On Windows this behavior is not allowed which results in an
error but on linux and osx it's allowed. To better test Windows
compatibilty adding this explicit check in is useful.
2024-07-01 22:12:32 +09:00
cec489
d881c686e6
Fix the btcctl uptime command
commit 0b2998b7f279d3aef4d83415dae26948f5a6bdf4
Author: cec489 <173723251+cec489@users.noreply.github.com>
Date:   Mon Jun 24 20:01:13 2024 +0000

    A cleaner fix is to set the startTime in the server Start() function
    which is where the server is actually started.

commit ae6c1256981befb43972e83a086ea663df629873
Author: cec489 <173723251+cec489@users.noreply.github.com>
Date:   Mon Jun 24 19:15:23 2024 +0000

    Fix the btcctl uptime command by moving the setting of startupTime
2024-06-27 13:36:29 -04:00
Robert
139669066c
Sending RPC requests through unix sockets (#2168)
Sending RPC requests through unix sockets
2024-06-26 16:42:49 -04:00
Oliver Gugger
b2eec96bea
Merge pull request #2206 from guggero/psbt-serialization-fix
psbt: decode keytype as compact size
2024-06-26 03:22:32 -06:00
Yong
cc26860b40
rpcclient: update error str to match both versions (#2205)
This commit updates the error str to match the same error returned from
`btcd` for both pre-0.24.2 and post-0.24.2.
2024-06-25 10:27:44 -04:00
Oliver Gugger
4bff778564
psbt: decode keytype as compact size
Fixes #2199.

Previous to this fix the keytype was only interpreted as a single byte,
even though BIP-0174 states it is to be parsed as a CompactSize/VarInt.
2024-06-25 16:03:05 +02:00
Oliver Gugger
f6db48af5a
Merge pull request #2201 from Roasbeef/v-0-24-2
build: bump version to v0.24.2-beta
2024-06-21 02:50:01 -06:00
Olaoluwa Osuntokun
cc4b27cdd9 build: bump version to v0.24.2-beta 2024-06-20 15:35:00 -07:00
Olaoluwa Osuntokun
93e729194e
Merge pull request #2197 from Crypt-iQ/2183_eugene
main, rpcclient, integration: add rpccalls for invalidate and reconsiderblock
2024-06-20 15:28:08 -07:00
Calvin Kim
0aa80ea8f7 main: Add invalidateblock and reconsiderblock rpc commands
The rpc calls and the rpchelp is added for the invalidateblock
and reconsiderblock methods on BlockChain.
2024-06-19 19:58:37 -04:00
Calvin Kim
1cb4d3a503 rpcclient, integration: Add invalidateblock and reconsiderblock
invalidateblock and reconsiderblock are added to the rpcclient package
and an integration test is added to test the added functions.
2024-06-19 19:58:29 -04:00
Olaoluwa Osuntokun
cd5e5bab63
Merge pull request #2196 from Crypt-iQ/2181_eugene
blockchain: Add ReconsiderBlock()
2024-06-19 16:07:14 -07:00
coderwander
11bd614171
Fix struct names (#2169)
Signed-off-by: coderwander <770732124@qq.com>
2024-06-19 11:38:54 -04:00
veth
976cbebd09
chore: fix some comments (#2191) 2024-06-19 11:37:10 -04:00
yujinpark
588b2e58cf
fix: typo (#2184) 2024-06-19 11:36:16 -04:00
Calvin Kim
52a8a2a06e blockchain: Add ReconsiderBlock to BlockChain
ReconsiderBlock reconsiders the validity of the block for the passed
in blockhash. The behavior of the function mimics that of Bitcoin Core.

The invalid status of the block nodes are reset and if the chaintip that
is being reconsidered has more cumulative work, then we'll validate the
blocks and reorganize to it. If the cumulative work is lesser than the
current active chain tip, then nothing else will be done.
2024-06-07 18:08:25 -04:00
Calvin Kim
eabc9bf50c blockchain: Refactor reorganizeChain to exclude verification
reorganizeChain() used to handle the following:
1: That the blocknodes being disconnected/connected indeed to connect
   properly without errors.
2: Perform the actual disconnect/connect of the blocknodes.

The functionality of 1, the validation that the disconnects/connects can
happen without errors are now refactored out into
verifyReorganizationValidity.

This is an effort made so that ReconsiderBlock() can call
verifyReorganizationValidity and set the block status of the
reconsidered chain and return nil even when an error returns as it's ok
to get an error when reconsidering an invalid branch.
2024-06-07 18:08:25 -04:00
Oliver Gugger
de4182589b
Merge pull request #2062 from lilasxie/refactor/parsefloat
refactor: set strconv.ParseFloat bitsize to 64
2024-06-03 13:02:00 +02:00
lilasxie
cccaa5f9b0 refactor: specify strconv.ParseFloat bitsize to 64 2024-06-03 18:28:21 +08:00
Oliver Gugger
d2d286f683
Merge pull request #2186 from MarcoEzekiel/DecodeNoLimitVersioned
Added DecodeNoLimitGeneric to bech32.go
2024-05-24 08:38:32 +02:00
Olaoluwa Osuntokun
c4677255bd
Merge pull request #2155 from kcalvinalvin/2024-04-02-invalidate-block
blockchain, fullblocktests, workmath, testhelper: add InvalidateBlock() method to BlockChain
2024-05-22 13:15:47 -07:00
Olaoluwa Osuntokun
b039ee6e56
Merge pull request #2182 from kcalvinalvin/2024-05-01-fix-logs
blockchain, main: add and fix logs
2024-05-22 11:35:21 -07:00
Olaoluwa Osuntokun
c4ed92fb52
Merge pull request #2178 from ProofOfKeags/standardness-cleanup
Update standardness rules congruent to Bitcoin Core
2024-05-21 15:44:24 -07:00
Keagan McClelland
da2f3b1e5f mempool: make txn's below 65 non-witness bytes non-standard
This is to mitigate CVE-2017-12842. Along the way, also error when
deserializing transactions that have the witness marker flag set
but have no witnesses. This matches Bitcoin Core's behaviour initially
introduced here https://github.com/bitcoin/bitcoin/pull/14039. Allowing
such transactions is benign, but this makes sure that our parsing code
matches Core's exactly.
2024-05-21 12:30:17 -07:00
Keagan McClelland
04469e600e txscript: make OP_CODESEPARATOR non-standard in non-segwit scripts 2024-05-21 12:30:16 -07:00
marcoezekiel
2492b01f69 btcutil/bech32: Added DecodeNoLimitWithVersion
This exposes publicly the ability to decode arbitrary-length bech32
strings and return the bech32 version that was used in the encoding. It
provides the underlying functionality for both DecodeNoLimit and
DecodeGeneric.
2024-05-13 12:02:40 -06:00
Calvin Kim
d65999e4a1 main: add logging if the node is pruned
For debug purposes down the road, log that the node is pruned if it's
set to pruned.
2024-05-01 18:02:05 +09:00
Calvin Kim
689ac6b6de blockchain: remove trailing ":" and space on utxocache log 2024-05-01 17:59:02 +09:00
Calvin Kim
635ae68957 blockchain: Add InvalidateBlock() method to BlockChain
InvalidateBlock() invalidates a given block and marks all its
descendents as invalid as well. The active chain tip changes if the
invalidated block is part of the best chain.
2024-04-30 17:13:32 +09:00
MarkDaveny
6b197d38d7
chore: fix some function names (#2180)
Signed-off-by: MarkDaveny <peicuiping@aliyun.com>
2024-04-29 11:45:39 -04:00
oftenoccur
126b0ecff1
chore: fix some typos in comments (#2164)
Signed-off-by: oftenoccur <ezc5@sina.com>
2024-04-26 08:08:05 -04:00
Calvin Kim
f1bded4ff6
chaincfg: update dnsseeds (#2174)
* chaincfg: remove unresponsive dnsseed on testnet

testnet-seed.bitcoin.schildbach.de is unresponsive and doesn't return
any ips.  Bitcoin Core has already removed it and we don't also be
getting rid of it as well.

* chaincfg: add dnsseeds from Sjors Provoost

His seeds work well and we don't have any for signet and it's good to
replace the lost dns seed on testnet.

* chaincfg: remove bad dnsseed (seed.bitcoinstats.com)

seed.bitcoinstats.com doesn't respect filter requests even though it's
advertised as it does. Plus it often returns nodes that are unreachable.
In my testing over the past week, it's been the most unreliable dns seed
and since we have plenty of mainnet seeds, it's better to do away with
this.

I documented my findings for this in a Bitcoin Core issue:
https://github.com/bitcoin/bitcoin/issues/29911

* chaincfg: add dnsseed from wiz

It's the same infrastructure that mempool . space runs on and has been
reliable.  The same seed is also included in Bitcoin Core as well.
2024-04-23 11:11:15 -04:00
Calvin Kim
f93f8501e3
release: add darwin-arm64 to target binaries (#2173)
All currently released Apple computers have arm architecture and it's
good to release something native for these computers.
2024-04-22 15:30:25 -04:00
Calvin Kim
ea39fe090d blockchain: add block generating functions in test code
The block generating functions here allow for a test to create mock
blocks.  This is useful for testing invalidateblock and reconsiderblock
methods on blockchain that will be added in later commits.
2024-04-23 02:52:13 +09:00
Calvin Kim
5df14376c1 fullblocktests, testhelper: move createSpendTx to testhelper
createSpendTx is moved to testhelper so that the function can be used
for callers in package blockchain without introducing import cycles.
The test code for invalidateblock and reconsiderblock that are going to
be added in later commits make use of this code.
2024-04-23 02:48:28 +09:00
Calvin Kim
8ab27b9245 fullblocktests, testhelper: move createCoinbaseTx to testhelper
createCoinbaseTx's code is refactored out and placed in testhelper
package and is exported so that callers in package blockchain can reuse
the code without introducing import cycles.  The test code for
invalidateblock and reconsiderblock that'll be added in later commits
make use of this code.
2024-04-23 02:48:28 +09:00
Calvin Kim
59c7d10507 fullblocktests, testhelper: move standardCoinbaseScript to testhelper
standardCoinbaseScript is moved to testhelper and is exported.  This
allows test code in package blockchain to reuse the code without
introducing an import cycle.  This code is used in the testing code
for invalidateblock and reconsiderblock that's added in the later
commits.
2024-04-23 02:48:28 +09:00
Calvin Kim
9093243d8b fullblocktests, testhelper: move uniqueOpReturnScript to testhelper
uniqueOpReturnScript is moved to testhelper and is exported so that the
code and be reused in package blockchain without introducing import
cycles.  The test code for invalidateblock and reconsiderblock that are
gonna be added in later commits uses the functions.
2024-04-23 02:48:28 +09:00
Calvin Kim
62790ac065 fullblocktests, testhelper: move opTrueScript and lowFee to testhelper
The variables are moved to testhelper so that they can be reused in the
blockchain package without introducing an import cycle.  The testing
code for invalidateblock and reconsiderblock that will be added in later
commits will be using these variables.
2024-04-23 02:48:28 +09:00
Calvin Kim
d4644dff10 fullblocktests, testhelper: move solveBlock to testhelper
solveBlock is moved to testhelper and is exported.  This is done so that
the code can be reused without introducing import cycles.  The testing
code to be added in alter commits for invalidateblock and reconsider
block will use SolveBlock.
2024-04-23 02:48:19 +09:00
Calvin Kim
337d7f6be8 fullblocktests, testhelper: refactor out spendableOut
spendableOut and the functions related to it are is moved to package
testhelper and are exported.  This is done to make the code reusable
without introducing an import cycle when the testing code for
invalidateblock and reconsiderblock are added in follow up commits.
2024-04-23 02:42:35 +09:00
Calvin Kim
597b68c79e blockchain, workmath: refactor functions to workmath package
Some of the functions in difficulty.go are not dependent on any external
functions and they are needed to introduce testing code for the
invalidateblock and reconsiderblock methods that are to be added on in
later commits. Having the workmath package let's us reuse the code and
avoid dependency cycles.

The existing functions that were exported already (HashToBig,
CompactToBig, BigToCompact, CalcWork) are still kept in difficulty.go
to avoid breaking external code that depends on those exported
functions.
2024-04-23 02:35:36 +09:00
Youngjoon Lee
569155bc6a
doc: fix config documentation for AgentWhitelist (#2140) 2024-04-10 15:37:44 -04:00