mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-30 10:35:32 +02:00
config: add a new --debughtlc config parameter
This commit adds a new configuration parameter to the deamon: ‘DebugHTLC’. When true, all outgoing HTLC’s sent via the RPC interface will be sent paying to a special rHash value which all lnd nodes also with the flag activated know the preimage to. Therefore all payments sent to a 1-hop node will immediately be settled by that node. By default, this flag is false, it it only intended to be used to exercise local changes to 1-hop behavior manually.
This commit is contained in:
12
rpcserver.go
12
rpcserver.go
@ -458,12 +458,22 @@ func (r *rpcServer) SendPayment(paymentStream lnrpc.Lightning_SendPaymentServer)
|
||||
return err
|
||||
}
|
||||
|
||||
// If we're in debug HTLC mode, then all outgoing
|
||||
// HTLC's will pay to the same debug rHash. Otherwise,
|
||||
// we pay to the rHash specified within the RPC
|
||||
// request.
|
||||
var rHash [32]byte
|
||||
if cfg.DebugHTLC {
|
||||
rHash = debugHash
|
||||
} else {
|
||||
copy(rHash[:], nextPayment.PaymentHash)
|
||||
}
|
||||
// Craft an HTLC packet to send to the routing sub-system. The
|
||||
// meta-data within this packet will be used to route the
|
||||
// payment through the network.
|
||||
htlcAdd := &lnwire.HTLCAddRequest{
|
||||
Amount: lnwire.CreditsAmount(nextPayment.Amt),
|
||||
RedemptionHashes: [][32]byte{debugHash},
|
||||
RedemptionHashes: [][32]byte{rHash},
|
||||
}
|
||||
destAddr, err := wire.NewShaHash(nextPayment.Dest)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user