Skip to content

Sync with Upstream#1

Open
2a5A1Ghu1 wants to merge 1096 commits intotheohmproject:masterfrom
btcsuite:master
Open

Sync with Upstream#1
2a5A1Ghu1 wants to merge 1096 commits intotheohmproject:masterfrom
btcsuite:master

Conversation

@2a5A1Ghu1
Copy link
Member

No description provided.

Roasbeef and others added 30 commits March 8, 2024 17:52
…ading-on-reorgs

blockchain: fix inconsistent utxocache and database on reorg
…entries-on-mapslice-impossible

blockchain: fix a bug where a duplicate entry is possible in the mapslice
…bscription-callback-errors

blockchain: always relock chainLock for subscription callbacks
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.
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.
rpcclient: add detailed error types
…ature-validation

Add check for maximum signature length in ecdsa.ParseDERSignature
build: bump version to v0.24.2-beta.rc1
This commit adds a method to MsgTx called TxID. This method returns the
transaction ID (txid) of the subject transaction.
wire: add method TxID to MsgTx
Convert `witnessToHex` into a method `ToHexStrings` on `TxWitness`
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.
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.
Signed-off-by: xiaoxiangxianzi <zhaoyizheng@outlook.com>
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.
btcclient+btcjson: defaultMaxFeeRate to BTC/kvB
Helper function for the added IsAncestor in the follow up commit.
Returns true if all the fields (except for parent and ancestor) are
equal.
IsAncestor() provides functionality for testing if a block node is
an ancestor of anther block node.
blockchain: Add IsAncestor method to blockNode
Signed-off-by: goodfirm <fanyishang@yeah.net>
gosunuts and others added 30 commits August 5, 2025 18:39
Fixes #2404.
If different versions of bitcoind return different error strings, we
need a way to match those as well.
rpcclient: add bitcoind version dependent error matching
Co-authored-by: Oliver Gugger <gugger@gmail.com>
Makefile+workflows: fallback to `GOPATH/bin` on non-existent `GOBIN`
build: bump version to v0.25.0-beta.rc1
This commit adds a new function to musig2.Session, which allows the caller
to add an external aggregated nonce to the session.
musig2: add WithExternalCombinedNonce option to Sign
Ensure that the dial phase of rpcclient's HTTP posts respects the http.Client's Timeout. It was instead falling back to the OS settings.
…dialcontext

rpcclient: ensure http dial respects timeout
build: bump version of Go container for release builds
This issue was discovered through differential fuzzing between btcd and
Bitcoin Core.

Add detection and filtering of IPv6 ORCHIDv2 addresses as defined by
RFC7343 (2001:20::/28). These addresses are overlay routable
cryptographic hash identifiers and should not be treated as routable
peer addresses, consistent with Bitcoin Core's behavior.

Changes:
- Add rfc7343Net variable for the 2001:20::/28 address block
- Add IsRFC7343() function to detect ORCHIDv2 addresses
- Update IsRoutable() to exclude RFC7343 addresses
- Add comprehensive test coverage for RFC7343 detection
- Fix incorrect error message in TestIPTypes (IsRFC1918 -> IsRFC6145)
This issue was discovered through differential fuzzing between btcd and
Bitcoin Core.

IPv4-mapped IPv6 addresses (::ffff:0:0/96, RFC 4291) sent with networkID
0x02 (IPv6) in addrv2 messages are now properly rejected. Per BIP155,
these addresses should use networkID 0x01 (IPv4) instead. This aligns
btcd's behavior with Bitcoin Core's addrv2 handling.

Changes:
- Add ipv4MappedPrefix constant for the ::ffff:0:0/96 prefix
- Add isIPv4Mapped() helper function to detect these addresses
- Update readNetAddressV2() to skip IPv4-mapped addresses with IPv6 networkID
- Add comprehensive test coverage for IPv4-mapped address detection
Add a bounds check against the remaining slab capacity so oversized
witness items return a decode error. Add a regression test for witness
items that overflow the decode slab.
To align with Bitcoin Core, reduce the maximum message payload size from
32MB to 4MB.
Add a recoverFromPanic method that catches panics in peer goroutines,
logs the error with a stack trace, and disconnects the offending peer
instead of crashing the entire node. This provides defense-in-depth
against future unknown panics in message parsing or handling.

Protect two goroutine boundaries:
- The negotiation goroutine in start(), which handles pre-handshake
  message decoding via BtcDecode.
- The inHandler goroutine, which processes all post-handshake messages.

Refactor inHandler cleanup from manual end-of-function calls to
defer-based cleanup, ensuring close(p.inQuit) always runs even on
panic, which prevents stallHandler from hanging.
html/template automatically HTML-escapes special characters to prevent
XSS, which can silently corrupt arbitrary script data. Since the output
is binary script bytes and not HTML, this escaping provides no benefit
and might breaks correctness.
txscript: switch template engine from html/template to text/template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.