dogecoin / libdohj

Java library for adding altcoin support to bitcoinj
Apache License 2.0
108 stars 89 forks source link

Connecting to nodes, wrong protocol version #2

Closed patricklodder closed 8 years ago

patricklodder commented 9 years ago

Currently, bitcoinj statically sets and reads NetworkParams.PROTOCOL_VERSION in many places such as PeerGroup. I did a quick patch to both bitcoinj and libdohj to be able to connect to 1.8.x nodes, basically implementing NetworkParams.getProtocolVersion() and overriding that in AbstractDogecoinParams.

Do you have a smarter way of doing this without having to patch bitcoinj?

rnicoll commented 9 years ago

Not that I can see - I'll raise a patch against bitcoinj!

There will be a few things like that I've missed, please do keep raising issues!

rnicoll commented 9 years ago

That said, protocol version isn't really a network parameter... might see if I can make it modifiable by code that knows it's using Doge...

patricklodder commented 9 years ago

My dirty patch for bitcoinj: https://github.com/patricklodder/bitcoinj/commit/b8e79be9ac8f10ccdaf22b816492a9c5c2b0d760

and added to AbstractDogecoinParams:

    public static final int DOGECOIN_PROTOCOL_VERSION = 70003;

    @Override
    public int getProtocolVersion() {
        return DOGECOIN_PROTOCOL_VERSION;
    }
rnicoll commented 9 years ago

Could you give the version of bitcoinj in https://github.com/rnicoll/bitcoinj/tree/protocol-altcoins a test please? https://github.com/bitcoinj/bitcoinj/compare/bitcoinj:master...rnicoll:protocol-altcoins?expand=1 may be useful in identifying the changes made. I haven't yet made matching changes to libdohj, I'll do that and commit them once the bitcoinj changes are confirmed.

patricklodder commented 9 years ago

I'll have a go somewhere after tomorrow's stresstest. my current pushtx code depends on all this right now :)

rnicoll commented 8 years ago

Hooks added in bitcoinj/bitcoinj#1095