accounting: export fee reference for itests

This commit is contained in:
carla 2020-07-30 15:46:20 +02:00
parent c6e6e92b48
commit b573d8f87e
No known key found for this signature in database
GPG key ID: 4CA7FE54A6213C91
2 changed files with 12 additions and 12 deletions

View file

@ -12,10 +12,10 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
)
// feeReference returns a special unique reference for the fee paid on a
// FeeReference returns a special unique reference for the fee paid on a
// transaction. We use the reference of the original entry with :-1 to denote
// that this entry is associated with the original entry.
func feeReference(reference string) string {
func FeeReference(reference string) string {
return fmt.Sprintf("%v:-1", reference)
}
@ -82,7 +82,7 @@ func channelOpenEntries(channel channelInfo, tx lndclient.Transaction,
note = channelOpenFeeNote(channel.channelID)
feeEntry, err := newHarmonyEntry(
tx.Timestamp, feeMsat, EntryTypeChannelOpenFee,
tx.TxHash, feeReference(tx.TxHash), note, true, convert,
tx.TxHash, FeeReference(tx.TxHash), note, true, convert,
)
if err != nil {
return nil, err
@ -151,7 +151,7 @@ func closedChannelEntries(channel closedChannelInfo, tx lndclient.Transaction,
feeEntry, err := newHarmonyEntry(
tx.Timestamp, feeAmt, EntryTypeChannelCloseFee,
tx.TxHash, feeReference(tx.TxHash), "",
tx.TxHash, FeeReference(tx.TxHash), "",
true, convert,
)
if err != nil {
@ -181,7 +181,7 @@ func sweepEntries(tx lndclient.Transaction, getFees getFeeFunc,
feeEntry, err := newHarmonyEntry(
tx.Timestamp, invertedSatsToMsats(fee), EntryTypeSweepFee,
tx.TxHash, feeReference(tx.TxHash), "", true, convert,
tx.TxHash, FeeReference(tx.TxHash), "", true, convert,
)
if err != nil {
return nil, err
@ -238,7 +238,7 @@ func onChainEntries(tx lndclient.Transaction,
feeEntry, err := newHarmonyEntry(
tx.Timestamp, feeAmt, feeType, tx.TxHash,
feeReference(tx.TxHash), "", true, convert,
FeeReference(tx.TxHash), "", true, convert,
)
if err != nil {
return nil, err
@ -356,7 +356,7 @@ func paymentEntry(payment paymentInfo, paidToSelf bool,
return []*HarmonyEntry{paymentEntry}, nil
}
feeRef := feeReference(ref)
feeRef := FeeReference(ref)
feeAmt := invertMsat(int64(payment.Fee))
feeEntry, err := newHarmonyEntry(

View file

@ -228,7 +228,7 @@ func TestChannelOpenEntry(t *testing.T) {
Amount: msatAmt,
FiatValue: fiat.MsatToUSD(mockBTCPrice.Price, msatAmt),
TxID: openChannelTx,
Reference: feeReference(openChannelTx),
Reference: FeeReference(openChannelTx),
Note: channelOpenFeeNote(channelID),
Type: EntryTypeChannelOpenFee,
OnChain: true,
@ -328,7 +328,7 @@ func TestChannelCloseEntry(t *testing.T) {
Amount: mockFeeMSat,
FiatValue: fiat.MsatToUSD(mockBTCPrice.Price, mockFeeMSat),
TxID: closeTx,
Reference: feeReference(closeTx),
Reference: FeeReference(closeTx),
Note: "",
Type: EntryTypeChannelCloseFee,
OnChain: true,
@ -423,7 +423,7 @@ func TestSweepEntry(t *testing.T) {
Amount: mockFeeMSat,
FiatValue: fiat.MsatToUSD(mockBTCPrice.Price, mockFeeMSat),
TxID: onChainTxID,
Reference: feeReference(onChainTxID),
Reference: FeeReference(onChainTxID),
Note: "",
Type: EntryTypeSweepFee,
OnChain: true,
@ -512,7 +512,7 @@ func TestOnChainEntry(t *testing.T) {
Amount: feeMsat,
FiatValue: fiat.MsatToUSD(mockBTCPrice.Price, feeMsat),
TxID: onChainTxID,
Reference: feeReference(onChainTxID),
Reference: FeeReference(onChainTxID),
Note: "",
Type: feeType,
OnChain: true,
@ -692,7 +692,7 @@ func TestPaymentEntry(t *testing.T) {
Amount: feeMsat,
FiatValue: fiat.MsatToUSD(mockBTCPrice.Price, feeMsat),
TxID: paymentHash,
Reference: feeReference(paymentRef),
Reference: FeeReference(paymentRef),
Note: paymentNote(&otherPubkey),
Type: EntryTypeFee,
OnChain: false,