Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lnd: add litecoin support for Neutrino #3062

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions chainparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,43 @@ func applyLitecoinParams(params *bitcoinNetParams, litecoinParams *litecoinNetPa
params.CoinbaseMaturity = litecoinParams.CoinbaseMaturity

copy(params.GenesisHash[:], litecoinParams.GenesisHash[:])
copy(params.GenesisBlock.Header.MerkleRoot[:],
litecoinParams.GenesisBlock.Header.MerkleRoot[:])
params.GenesisBlock.Header.Version =
litecoinParams.GenesisBlock.Header.Version
params.GenesisBlock.Header.Timestamp =
litecoinParams.GenesisBlock.Header.Timestamp
params.GenesisBlock.Header.Bits =
litecoinParams.GenesisBlock.Header.Bits
params.GenesisBlock.Header.Nonce =
litecoinParams.GenesisBlock.Header.Nonce
params.GenesisBlock.Transactions[0].Version =
litecoinParams.GenesisBlock.Transactions[0].Version
params.GenesisBlock.Transactions[0].LockTime =
litecoinParams.GenesisBlock.Transactions[0].LockTime
params.GenesisBlock.Transactions[0].TxIn[0].Sequence =
litecoinParams.GenesisBlock.Transactions[0].TxIn[0].Sequence
params.GenesisBlock.Transactions[0].TxIn[0].PreviousOutPoint.Index =
litecoinParams.GenesisBlock.Transactions[0].TxIn[0].PreviousOutPoint.Index
copy(params.GenesisBlock.Transactions[0].TxIn[0].SignatureScript[:],
litecoinParams.GenesisBlock.Transactions[0].TxIn[0].SignatureScript[:])
copy(params.GenesisBlock.Transactions[0].TxOut[0].PkScript[:],
litecoinParams.GenesisBlock.Transactions[0].TxOut[0].PkScript[:])
params.GenesisBlock.Transactions[0].TxOut[0].Value =
litecoinParams.GenesisBlock.Transactions[0].TxOut[0].Value
params.GenesisBlock.Transactions[0].TxIn[0].PreviousOutPoint.Hash =
chainhash.Hash{}
params.PowLimitBits = litecoinParams.PowLimitBits
params.PowLimit = litecoinParams.PowLimit

dnsSeeds := make([]chaincfg.DNSSeed, len(litecoinParams.DNSSeeds))
for i := 0; i < len(litecoinParams.DNSSeeds); i++ {
dnsSeeds[i] = chaincfg.DNSSeed{
Host: litecoinParams.DNSSeeds[i].Host,
HasFiltering: litecoinParams.DNSSeeds[i].HasFiltering,
}
}
params.DNSSeeds = dnsSeeds

// Address encoding magics
params.PubKeyHashAddrID = litecoinParams.PubKeyHashAddrID
Expand Down
7 changes: 5 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,12 @@ func loadConfig() (*config, error) {
"credentials for litecoind: %v", err)
return nil, err
}
case "neutrino":
// No need to get RPC parameters.

default:
str := "%s: only ltcd and litecoind mode supported for " +
"litecoin at this time"
str := "%s: only ltcd, litecoind, and neutrino mode " +
"supported for litecoin at this time"
return nil, fmt.Errorf(str, funcName)
}

Expand Down