bitcoinfuzz icon indicating copy to clipboard operation
bitcoinfuzz copied to clipboard

addrv2: Mismatch between btcd + rust-bitcoin and Bitcoin Core

Open brunoerg opened this issue 3 months ago • 1 comments

Addrv2 parse failed
Module: Btcd
Result: clearnet=1tor=0cjdns=0i2p=0
Module: rust-bitcoin
Result: clearnet=1tor=0cjdns=0i2p=0
Module: Bitcoin
Result: clearnet=0tor=0cjdns=0i2p=0

Base64: CDvv7+/vAQRjYQD9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABlMQAAACg=

I debugged it and the clearnet address parsed by btcd and rust-bitcoin is 99.97.0.253, Bitcoin Core parses this same address but fails due to another one that is :: (which is not routable - that's why clearnet=0).

brunoerg avatar Sep 22 '25 20:09 brunoerg

On btcd:

func TestAddr(t *testing.T) {
	data := []byte{
		0x01,                   
		0x3b, 0xef, 0xef, 0xef,
		0xef, 0x01, 0x04, 0x63, 
		0x61, 0x00, 0xfd, 0x00,
		0x00, 0x00, 0x00, 0x00,
		0x00, 
		0x00,
		0x00, 0x00,
	}
	msg := MsgAddrV2{}
	err := msg.BtcDecode(bytes.NewReader(data), 0, WitnessEncoding)
	if err == nil {
		for i := 0; i < len(msg.AddrList); i++ {
			println("addr: %v\n", msg.AddrList[i].Addr.String())
		}
	}
}

brunoerg avatar Sep 24 '25 17:09 brunoerg