client/asset/ltc: native litecoin spv wallet#1750
Conversation
|
Do we want to PR all the neutrino fixes to their fork too? The btcsuite forks and their maintenance is the main reason why I'm wary about these. |
|
I haven't checked commits one-by-one, but it looks like the ltcsuite neutrino repo gets more attention than others. If I have to maintain fix branches because we have trouble getting upstream PRs merged, so be it. I don't think it needs to stop our progress. |
They forked from lightning labs more recently is all afaict. Neither have seen much attention since forking.
That doesn't give me warm fuzzies, but I feel like if we do want neutrino wallets for BCH and LTC (and I support this with caution) we should have forks that we maintain. The upstreams are not going to see maintenance, that much is clear. We should either talk to dhilll about some separate repos under the decred github org or we make a new org for dcrdex forks of things that we admin. On a side note, ltcd/wire still does not know how to decode their own MW blocks or txns. |
5065ee1 to
868e7b6
Compare
|
Just merged all of our neutrino-ltc PRs (and rewrote the module and import names), and PR'd the same |
| Description: "Use an external Electrum-LTC Wallet", | ||
| // json: DefaultConfigPath: filepath.Join(btcutil.AppDataDir("electrum-ltc", false), "config"), // e.g. ~/.electrum-ltc/config ConfigOpts: append(rpcOpts, commonOpts...), | ||
| ConfigOpts: commonOpts, | ||
| ConfigOpts: btc.CommonConfigOpts("LTC"), |
There was a problem hiding this comment.
Electrum needs the RPC options too.
| Description: "Connect to litecoind", | ||
| DefaultConfigPath: dexbtc.SystemConfigPath("litecoin"), | ||
| ConfigOpts: append(walletNameOpt, commonOpts...), | ||
| ConfigOpts: append(btc.RPCConfigOpts("Litecoin", "9332"), btc.CommonConfigOpts("LTC")...), |
There was a problem hiding this comment.
commonOpts above is unused now.
chappjc
left a comment
There was a problem hiding this comment.
Looks cool.
I think splitting btc/spv.go is warranted though. See comments on that.
Also, I think every hash conversion is replaceable with an explicit type conversion, no copy.
| // exceptions, and have some critical code that needed to be duplicated (in | ||
| // order to avoid interface hell). | ||
| type ltcSPVWallet struct { | ||
| // This section is populated in newSPVWallet. |
| @@ -1186,43 +1181,37 @@ func (w *spvWallet) connect(ctx context.Context, wg *sync.WaitGroup) error { | |||
|
|
|||
| // startWallet initializes the *btcwallet.Wallet and its supporting players and | |||
| // btcsuite types to ltcsuite and vice-versa. Startup and shutdown are notable | ||
| // exceptions, and have some critical code that needed to be duplicated (in | ||
| // order to avoid interface hell). | ||
| type ltcSPVWallet struct { |
There was a problem hiding this comment.
The btc parallel is walletExtender, created by newExtendedWallet, yes?
I would not object to s/walletExtender/btcSPVWallet to make this a more obvious design pattern... or even moving all the walletExtender methods into a separate file (or the higher level spvWallet methods into spv_wrapper.go). Their methods are all interleaved in the same file right now.
|
Rebased and uses dcrlabs now, and attempted to add an addpeer for testnet4, but having lots of troubles getting connected to a local node. Not other review comments addressed yet. |
|
Needs rebase with the BCH one merged |
|
Considering the current conflict, I don't know that an external fee rate api makes sense for electrum since the fee rates are coming from external sources anyway (electrumx servers). It would be more an alternate source. Maybe that's useful? |
| github.com/dcrlabs/neutrino-bch v0.0.0-20220809174944-921b271ba678 // indirect | ||
| github.com/dcrlabs/neutrino-ltc v0.0.0-20220819181220-04c154bb8ed8 // indirect |
There was a problem hiding this comment.
Just noticing that loadbot's go.mod still has the replace github.com/gcash/neutrino => github.com/buck54321/neutrino-bch
chappjc
left a comment
There was a problem hiding this comment.
Extremely clean port from BCH for the most part. (Comparing client/asset/ltc/spv.go and client/asset/bch/spv.go).
Compared master's client/asset/btc/spv.go and client/asset/btc/spv_wrapper.go and that checks out fine too, other than estimateSendTxFee migrating within the file.
| return w.chainParams | ||
| } | ||
| spoofParams := *w.chainParams | ||
| spoofParams.Net = ltcwire.TestNet3 |
There was a problem hiding this comment.
Madness. Ok since it works, but I'll submit a PR to fix if this works:
replace github.com/ltcsuite/ltcwallet => github.com/chappjc/btcwallet v0.12.1-0.20220927170114-882f9a5992bc
There was a problem hiding this comment.
Fix PR submitted after testing with the replace and this Net patching code commented out: ltcsuite/ltcwallet#8
|
I may have made a poor suggestion with the spv.go -> spv_wrapper.go rename. |
|
Approved, but please rebase and resolve the go.mod conflict. |
|
May squash. |
Same as #1635, but for Litecoin.