Commit Graph

4068 Commits

Author SHA1 Message Date
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
youngxhui
64c9011d72
Update developer_resources.md (#2158)
fix btcutil link error
2024-04-10 13:00:23 -04:00
goodfirm
9f93dc1842
chore: fix function names in comment (#2163)
Signed-off-by: goodfirm <fanyishang@yeah.net>
2024-04-10 12:59:42 -04:00
zhiqiangxu
2f4ff8447d
fix some typos and make OP_DATA_20 explicit in comment (#2080) 2024-04-10 10:08:30 -04:00
Olaoluwa Osuntokun
5d50f7c83e
Merge pull request #2153 from kcalvinalvin/2024-04-02-add-is-ancestor
blockchain: Add IsAncestor method to blockNode
2024-04-09 20:10:58 -07:00
Olaoluwa Osuntokun
e4b32e0ba9
Merge pull request #2156 from ffranr/add-pubkey-serialized-type
Add new serialized pubkey type
2024-04-09 20:06:05 -07:00
Olaoluwa Osuntokun
92b24d2ed3
Merge pull request #2150 from xiaoxianBoy/fix-typos
chore: fix typos
2024-04-09 20:05:14 -07:00
Calvin Kim
bc6396ddfd blockchain: Add IsAncestor method to blockNode
IsAncestor() provides functionality for testing if a block node is
an ancestor of anther block node.
2024-04-08 17:47:26 +09:00
Calvin Kim
c9c8795160 blockchain: add Equals method to blockNode
Helper function for the added IsAncestor in the follow up commit.
Returns true if all the fields (except for parent and ancestor) are
equal.
2024-04-08 17:47:08 +09:00
Olaoluwa Osuntokun
ae5533602c
Merge pull request #2142 from YusukeShimizu/feeRate-BTCkvB
btcclient+btcjson: defaultMaxFeeRate to BTC/kvB
2024-04-02 19:19:26 -07:00
ffranr
665eeb52b1
btcec: add new type SerializedKey
This commit adds a new type called `SerializedKey`.

A serialized type is useful when using public keys as map keys. This is
because functionally identical public keys can have different internal
representations. These differences would cause the map to treat them as
different keys.
2024-04-02 21:19:03 +01:00
ffranr
31647e46ec
btcec: add missing doc comments 2024-04-02 21:19:03 +01:00
snoppy
9851d96c06
chore: fix typos 2024-03-29 10:21:29 +08:00
xiaoxiangxianzi
95330bc1bb
chore: fix some comments (#2146)
Signed-off-by: xiaoxiangxianzi <zhaoyizheng@outlook.com>
2024-03-27 09:45:48 -04:00
bruwbird
80b27f5471
btcclient+btcjson: add type alias for BTC/kvB
Added type alias BTC/kvB to explicitly indicate that
it represents the fee in BTC for a transaction size of 1 kB.
Because bitcoind uses its own fee rate type
(BTC/kvB instead of sat/kWU we use in lnd),
define the type in btcjson package,
as it's the only place where we actually use BTC/kvB.
2024-03-27 17:58:12 +09:00
bruwbird
bbb6967247
btcclient+btcjson: feeRate to BTC/kvB
defaultMaxFeeRate was set to 1e8 / 10(sat/kb) as a parameter.
But BTC/kvB is the expected value, so the units was wrong.
This commit updates defaultMaxFeeRate to BTC/kvB and sets it to 0.1,
which is the default value of Bitcoin Core.
This commit also updates the comment to reflect the change.

Because maxFeeRate sanity check has been added in
bitcoin core v27.0 or later,
sendrawtransaction cannot be executed without this change.
2024-03-27 17:58:12 +09:00
Oliver Gugger
a03259b26b
Merge pull request #1991 from ffranr/add-json-support
Convert `witnessToHex` into a method `ToHexStrings` on `TxWitness`
2024-03-26 13:03:46 -06:00
Oliver Gugger
429d00fe3b
Merge pull request #2091 from zhiqiangxu/rm_trailing_continue
chore: remove trailing continue
2024-03-26 02:36:00 -06:00
zhiqiangxu
6ae24a0693 mining: remove trailing continue 2024-03-26 13:21:01 +08:00
mattn
3cb9f602e8
fix typos (#2100) 2024-03-25 09:44:25 -04:00
ffranr
75fe7e4790
wire: make witnessToHex a TxWitness method called ToHexStrings 2024-03-25 12:56:12 +00:00
Oliver Gugger
e39d2eb63d
Merge pull request #2055 from ffranr/add-msgtx-txid
wire: add method TxID to MsgTx
2024-03-25 06:50:31 -06:00
ffranr
2a225e9d36
wire: add method TxID to MsgTx
This commit adds a method to MsgTx called TxID. This method returns the
transaction ID (txid) of the subject transaction.
2024-03-25 12:21:41 +00:00
Olaoluwa Osuntokun
8b2f43e9ce
Merge pull request #2136 from Roasbeef/btcd-24-0-2-rc1
build: bump version to v0.24.2-beta.rc1
2024-03-18 17:45:13 -04:00
Olaoluwa Osuntokun
a90d3d93e9
Merge pull request #2135 from SulaimanAminuBarkindo/improved-der-signature-validation
Add check for maximum signature length in ecdsa.ParseDERSignature
2024-03-18 17:44:26 -04:00
Oliver Gugger
2fc99e0496
Merge pull request #2138 from yyforyongyu/error-matching
rpcclient: add detailed error types
2024-03-18 09:17:28 -06:00
yyforyongyu
8abf969c3c
rpcserver: return the plain reject reason from btcd
This commit changes the `RejectReason` resulted from calling
btcd's `testmempoolaccept` to be un-matched, leaving it to the caller to
decide when and where to match it.
2024-03-18 23:08:48 +08:00
yyforyongyu
36683e0b96
rpcclient: define specific errors for chain backends
This commit adds detailed errors for all possible errors returned from
`sendrawtransaction` or `testmempoolaccept`, enabling upstream callers
to have refined control over the actions to be taken.
2024-03-18 23:08:47 +08:00