Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
fix: linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Sep 19, 2023
1 parent ddbc046 commit 77438bb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
10 changes: 5 additions & 5 deletions beef_tx_sorting.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package bux

func kahnTopologicalSortTransactions(transactions []*Transaction) []*Transaction {
txById, incomingEdgesMap, zeroIncomingEdgeQueue := prepareSortStructures(transactions)
txByID, incomingEdgesMap, zeroIncomingEdgeQueue := prepareSortStructures(transactions)
result := make([]*Transaction, 0, len(transactions))

for len(zeroIncomingEdgeQueue) > 0 {
txID := zeroIncomingEdgeQueue[0]
zeroIncomingEdgeQueue = zeroIncomingEdgeQueue[1:]

tx := txById[txID]
tx := txByID[txID]
result = append(result, tx)

zeroIncomingEdgeQueue = removeTxFromIncomingEdges(tx, incomingEdgesMap, zeroIncomingEdgeQueue)
Expand All @@ -18,13 +18,13 @@ func kahnTopologicalSortTransactions(transactions []*Transaction) []*Transaction
return result
}

func prepareSortStructures(dag []*Transaction) (txById map[string]*Transaction, incomingEdgesMap map[string]int, zeroIncomingEdgeQueue []string) {
func prepareSortStructures(dag []*Transaction) (txByID map[string]*Transaction, incomingEdgesMap map[string]int, zeroIncomingEdgeQueue []string) {
dagLen := len(dag)
txById = make(map[string]*Transaction, dagLen)
txByID = make(map[string]*Transaction, dagLen)
incomingEdgesMap = make(map[string]int, dagLen)

for _, tx := range dag {
txById[tx.ID] = tx
txByID[tx.ID] = tx
incomingEdgesMap[tx.ID] = 0
}

Expand Down
2 changes: 1 addition & 1 deletion chainstate/mock_const.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
onChainExample1TxID = "908c26f8227fa99f1b26f99a19648653a1382fb3b37b03870e9c138894d29b3b" //nolint:gosec // this is a dummy value

// API key
testDummyKey = "test-dummy-api-key-value" //nolint:gosec // this is a dummy key
// testDummyKey = "test-dummy-api-key-value" //nolint:gosec // this is a dummy key

// Signatures
matterCloudSig1 = "30450221008003e78e2154e9686a2bb864a811e7ec950093f273f94d222fa87c81a5daf8f6022018e1098ad2a3f1adc431ddd375c06c867d79e484710dc87ac6847b3a2f4909d2"
Expand Down
8 changes: 4 additions & 4 deletions chainstate/mock_minercraft.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,11 +778,11 @@ func (m *minerCraftUnreachble) FeeQuote(context.Context, *minercraft.Miner) (*mi
return nil, errors.New("minercraft is unreachable")
}

type minerCraftBroadcastTimeout struct {
/*type minerCraftBroadcastTimeout struct {
MinerCraftBase
}
}*/

func (m *minerCraftBroadcastTimeout) SubmitTransaction(_ context.Context, miner *minercraft.Miner,
/*func (m *minerCraftBroadcastTimeout) SubmitTransaction(_ context.Context, miner *minercraft.Miner,
_ *minercraft.Transaction,
) (*minercraft.SubmitTransactionResponse, error) {
time.Sleep(defaultBroadcastTimeOut * 2)
Expand All @@ -808,4 +808,4 @@ func (m *minerCraftBroadcastTimeout) SubmitTransaction(_ context.Context, miner
TxID: "",
},
}, nil
}
}*/
3 changes: 2 additions & 1 deletion chainstate/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
)

const testTransactionHex = `0100000001979f9f1033357ab26d71381d40d94069fe2e795aed3b1bc9f28de57c57b278ed030000006a47304402207122f4592d4ddae3214bbafa9b25dd86516bc25698228a3ec1caf8d7b5fabf23022054c1347b421c55cc362227e00c5d18660271b670f2af2484ca1cb31f0ac405f2412102069a1aa13ed2c8f2d1bb7b4c3bee2e8333594ee0c0e2e9188157e8d08b8ceac9ffffffff0123020000000000001976a914a9041707efa4c2edea3e3b93c83330b55c6497d088ac00000000`
const testTransactionID = `512a47f5cfd2e7e22e3d440d3e8c445e41eba55b23ff5f3f696c7f106c22eab3`

// const testTransactionID = `512a47f5cfd2e7e22e3d440d3e8c445e41eba55b23ff5f3f696c7f106c22eab3`
const testTransaction = `{
"txid": "512a47f5cfd2e7e22e3d440d3e8c445e41eba55b23ff5f3f696c7f106c22eab3",
"hash": "512a47f5cfd2e7e22e3d440d3e8c445e41eba55b23ff5f3f696c7f106c22eab3",
Expand Down
4 changes: 2 additions & 2 deletions model_compound_merkle_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func (cmp *CompoundMerklePath) Bytes() []byte {
}

// Bytes returns CMPSlice bytes
func (cmpSlice *CMPSlice) Bytes() []byte {
func (cmps *CMPSlice) Bytes() []byte {
var buff bytes.Buffer

for _, cmp := range *cmpSlice {
for _, cmp := range *cmps {
buff.Write(cmp.Bytes())
}

Expand Down
2 changes: 2 additions & 0 deletions model_transaction_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ type TransactionOutput struct {
UseForChange bool `json:"use_for_change,omitempty" toml:"use_for_change" yaml:"use_for_change" bson:"use_for_change,omitempty"` // if set, no change destinations will be created, but all outputs flagged will get the change
}

// PaymailPayloadFormat is the format of the paymail payload
type PaymailPayloadFormat uint32

// Types of Paymail payload formats
const (
BasicPaymailPayloadFormat PaymailPayloadFormat = iota
BeefPaymailPayloadFormat
Expand Down

0 comments on commit 77438bb

Please sign in to comment.