lnd: fix unconvert warnings
This commit is contained in:
parent
f2843dd4c9
commit
143a6e01bb
@ -560,7 +560,7 @@ func (b *BtcdNotifier) checkConfirmationTrigger(txSha *chainhash.Hash,
|
|||||||
// which notification(s) we should fire off with
|
// which notification(s) we should fire off with
|
||||||
// each incoming block.
|
// each incoming block.
|
||||||
confClient.initialConfirmHeight = uint32(newTip.blockHeight)
|
confClient.initialConfirmHeight = uint32(newTip.blockHeight)
|
||||||
finalConfHeight := uint32(confClient.initialConfirmHeight + confClient.numConfirmations - 1)
|
finalConfHeight := confClient.initialConfirmHeight + confClient.numConfirmations - 1
|
||||||
heapEntry := &confEntry{
|
heapEntry := &confEntry{
|
||||||
confClient,
|
confClient,
|
||||||
confDetails,
|
confDetails,
|
||||||
|
@ -400,7 +400,7 @@ func (c *OpenChannel) UpdateCommitment(newCommitment *wire.MsgTx,
|
|||||||
c.OurCommitSig = newSig
|
c.OurCommitSig = newSig
|
||||||
c.OurBalance = delta.LocalBalance
|
c.OurBalance = delta.LocalBalance
|
||||||
c.TheirBalance = delta.RemoteBalance
|
c.TheirBalance = delta.RemoteBalance
|
||||||
c.NumUpdates = uint64(delta.UpdateNum)
|
c.NumUpdates = delta.UpdateNum
|
||||||
c.Htlcs = delta.Htlcs
|
c.Htlcs = delta.Htlcs
|
||||||
|
|
||||||
// First we'll write out the current latest dynamic channel
|
// First we'll write out the current latest dynamic channel
|
||||||
@ -1137,13 +1137,13 @@ func putChanAmountsTransferred(openChanBucket *bolt.Bucket, channel *OpenChannel
|
|||||||
copy(keyPrefix[3:], b.Bytes())
|
copy(keyPrefix[3:], b.Bytes())
|
||||||
|
|
||||||
copy(keyPrefix[:3], satSentPrefix)
|
copy(keyPrefix[:3], satSentPrefix)
|
||||||
byteOrder.PutUint64(scratch1, uint64(channel.TotalSatoshisSent))
|
byteOrder.PutUint64(scratch1, channel.TotalSatoshisSent)
|
||||||
if err := openChanBucket.Put(keyPrefix, scratch1); err != nil {
|
if err := openChanBucket.Put(keyPrefix, scratch1); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(keyPrefix[:3], satReceivedPrefix)
|
copy(keyPrefix[:3], satReceivedPrefix)
|
||||||
byteOrder.PutUint64(scratch2, uint64(channel.TotalSatoshisReceived))
|
byteOrder.PutUint64(scratch2, channel.TotalSatoshisReceived)
|
||||||
return openChanBucket.Put(keyPrefix, scratch2)
|
return openChanBucket.Put(keyPrefix, scratch2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ func (c *ChannelGraph) PruneGraph(spentOutputs []*wire.OutPoint,
|
|||||||
// current UTXO state.
|
// current UTXO state.
|
||||||
var newTip [pruneTipBytes]byte
|
var newTip [pruneTipBytes]byte
|
||||||
copy(newTip[:], blockHash[:])
|
copy(newTip[:], blockHash[:])
|
||||||
byteOrder.PutUint32(newTip[32:], uint32(blockHeight))
|
byteOrder.PutUint32(newTip[32:], blockHeight)
|
||||||
|
|
||||||
return metaBucket.Put(pruneTipKey, newTip[:])
|
return metaBucket.Put(pruneTipKey, newTip[:])
|
||||||
})
|
})
|
||||||
|
@ -1097,7 +1097,7 @@ func normalizeFunc(edges []*lnrpc.ChannelEdge, scaleFactor float64) func(int64)
|
|||||||
y := math.Log2(float64(x))
|
y := math.Log2(float64(x))
|
||||||
|
|
||||||
// TODO(roasbeef): results in min being zero
|
// TODO(roasbeef): results in min being zero
|
||||||
return float64(y-min) / float64(max-min) * scaleFactor
|
return y-min / max-min * scaleFactor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
wireMsg := htlcPkt.msg.(*lnwire.UpdateAddHTLC)
|
wireMsg := htlcPkt.msg.(*lnwire.UpdateAddHTLC)
|
||||||
amt := btcutil.Amount(wireMsg.Amount)
|
amt := wireMsg.Amount
|
||||||
|
|
||||||
// Handle this send request in a distinct goroutine in
|
// Handle this send request in a distinct goroutine in
|
||||||
// order to avoid a possible deadlock between the htlc
|
// order to avoid a possible deadlock between the htlc
|
||||||
|
@ -62,13 +62,13 @@ func writeElement(w io.Writer, element interface{}) error {
|
|||||||
switch e := element.(type) {
|
switch e := element.(type) {
|
||||||
case uint8:
|
case uint8:
|
||||||
var b [1]byte
|
var b [1]byte
|
||||||
b[0] = byte(e)
|
b[0] = e
|
||||||
if _, err := w.Write(b[:]); err != nil {
|
if _, err := w.Write(b[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case uint16:
|
case uint16:
|
||||||
var b [2]byte
|
var b [2]byte
|
||||||
binary.BigEndian.PutUint16(b[:], uint16(e))
|
binary.BigEndian.PutUint16(b[:], e)
|
||||||
if _, err := w.Write(b[:]); err != nil {
|
if _, err := w.Write(b[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -86,13 +86,13 @@ func writeElement(w io.Writer, element interface{}) error {
|
|||||||
}
|
}
|
||||||
case uint32:
|
case uint32:
|
||||||
var b [4]byte
|
var b [4]byte
|
||||||
binary.BigEndian.PutUint32(b[:], uint32(e))
|
binary.BigEndian.PutUint32(b[:], e)
|
||||||
if _, err := w.Write(b[:]); err != nil {
|
if _, err := w.Write(b[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case uint64:
|
case uint64:
|
||||||
var b [8]byte
|
var b [8]byte
|
||||||
binary.BigEndian.PutUint64(b[:], uint64(e))
|
binary.BigEndian.PutUint64(b[:], e)
|
||||||
if _, err := w.Write(b[:]); err != nil {
|
if _, err := w.Write(b[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ func serializeSigToWire(b *[64]byte, e *btcec.Signature) error {
|
|||||||
// is the second byte after R ends. 0x02 signifies a length-prefixed,
|
// is the second byte after R ends. 0x02 signifies a length-prefixed,
|
||||||
// zero-padded, big-endian bigint. 0x30 sigifies a DER signature.
|
// zero-padded, big-endian bigint. 0x30 sigifies a DER signature.
|
||||||
// See the Serialize() method for btcec.Signature for details.
|
// See the Serialize() method for btcec.Signature for details.
|
||||||
rLen := uint8(sig[3])
|
rLen := sig[3]
|
||||||
sLen := uint8(sig[5+rLen])
|
sLen := sig[5+rLen]
|
||||||
|
|
||||||
// Check to make sure R and S can both fit into their intended buffers.
|
// Check to make sure R and S can both fit into their intended buffers.
|
||||||
// We check S first because these code blocks decrement sLen and
|
// We check S first because these code blocks decrement sLen and
|
||||||
|
2
peer.go
2
peer.go
@ -1766,7 +1766,7 @@ func logEntryToHtlcPkt(chanPoint wire.OutPoint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
htlc := &lnwire.UpdateAddHTLC{
|
htlc := &lnwire.UpdateAddHTLC{
|
||||||
Amount: btcutil.Amount(pd.Amount),
|
Amount: pd.Amount,
|
||||||
PaymentHash: pd.RHash,
|
PaymentHash: pd.RHash,
|
||||||
}
|
}
|
||||||
copy(htlc.OnionBlob[:], b.Bytes())
|
copy(htlc.OnionBlob[:], b.Bytes())
|
||||||
|
@ -871,7 +871,7 @@ func (r *rpcServer) savePayment(route *routing.Route, amount btcutil.Amount,
|
|||||||
payment := &channeldb.OutgoingPayment{
|
payment := &channeldb.OutgoingPayment{
|
||||||
Invoice: channeldb.Invoice{
|
Invoice: channeldb.Invoice{
|
||||||
Terms: channeldb.ContractTerm{
|
Terms: channeldb.ContractTerm{
|
||||||
Value: btcutil.Amount(amount),
|
Value: amount,
|
||||||
},
|
},
|
||||||
CreationDate: time.Now(),
|
CreationDate: time.Now(),
|
||||||
},
|
},
|
||||||
|
@ -432,7 +432,7 @@ func (k *kidOutput) waitForPromotion(db *channeldb.DB, confChan *chainntnfs.Conf
|
|||||||
utxnLog.Infof("Outpoint %v confirmed in block %v moving to kindergarten",
|
utxnLog.Infof("Outpoint %v confirmed in block %v moving to kindergarten",
|
||||||
k.outPoint, txConfirmation.BlockHeight)
|
k.outPoint, txConfirmation.BlockHeight)
|
||||||
|
|
||||||
k.confHeight = uint32(txConfirmation.BlockHeight)
|
k.confHeight = txConfirmation.BlockHeight
|
||||||
|
|
||||||
// The following block deletes a kidOutput from the preschool database
|
// The following block deletes a kidOutput from the preschool database
|
||||||
// bucket and adds it to the kindergarten database bucket which is
|
// bucket and adds it to the kindergarten database bucket which is
|
||||||
@ -462,7 +462,7 @@ func (k *kidOutput) waitForPromotion(db *channeldb.DB, confChan *chainntnfs.Conf
|
|||||||
maturityHeight := k.confHeight + k.blocksToMaturity
|
maturityHeight := k.confHeight + k.blocksToMaturity
|
||||||
|
|
||||||
heightBytes := make([]byte, 4)
|
heightBytes := make([]byte, 4)
|
||||||
byteOrder.PutUint32(heightBytes, uint32(maturityHeight))
|
byteOrder.PutUint32(heightBytes, maturityHeight)
|
||||||
|
|
||||||
// If there're any existing outputs for this particular block
|
// If there're any existing outputs for this particular block
|
||||||
// height target, then we'll append this new output to the
|
// height target, then we'll append this new output to the
|
||||||
@ -675,7 +675,7 @@ func deleteGraduatedOutputs(db *channeldb.DB, deleteHeight uint32) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
heightBytes := make([]byte, 4)
|
heightBytes := make([]byte, 4)
|
||||||
byteOrder.PutUint32(heightBytes, uint32(deleteHeight))
|
byteOrder.PutUint32(heightBytes, deleteHeight)
|
||||||
results := kgtnBucket.Get(heightBytes)
|
results := kgtnBucket.Get(heightBytes)
|
||||||
if results == nil {
|
if results == nil {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user