Skip to content
Merged
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
4 changes: 2 additions & 2 deletions ledger/allegra/allegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (b *AllegraBlock) Transactions() []common.Transaction {
}

func (b *AllegraBlock) Utxorpc() *utxorpc.Block {
var txs []*utxorpc.Tx
txs := []*utxorpc.Tx{}
tmpHash, _ := hex.DecodeString(b.Hash())
for _, t := range b.Transactions() {
tx := t.Utxorpc()
Expand Down Expand Up @@ -274,7 +274,7 @@ func (t AllegraTransaction) Consumed() []common.TransactionInput {
}

func (t AllegraTransaction) Produced() []common.Utxo {
var ret []common.Utxo
ret := []common.Utxo{}
for idx, output := range t.Outputs() {
ret = append(
ret,
Expand Down
2 changes: 1 addition & 1 deletion ledger/alonzo/alonzo.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (b *AlonzoBlock) Transactions() []common.Transaction {
}

func (b *AlonzoBlock) Utxorpc() *utxorpc.Block {
var txs []*utxorpc.Tx
txs := []*utxorpc.Tx{}
tmpHash, _ := hex.DecodeString(b.Hash())
for _, t := range b.Transactions() {
tx := t.Utxorpc()
Expand Down
7 changes: 4 additions & 3 deletions ledger/babbage/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (b *BabbageBlock) Transactions() []common.Transaction {
}

func (b *BabbageBlock) Utxorpc() *utxorpc.Block {
var txs []*utxorpc.Tx
txs := []*utxorpc.Tx{}
tmpHash, _ := hex.DecodeString(b.Hash())
for _, t := range b.Transactions() {
tx := t.Utxorpc()
Expand Down Expand Up @@ -265,8 +265,9 @@ func (b *BabbageTransactionBody) TotalCollateral() uint64 {
}

func (b *BabbageTransactionBody) Utxorpc() *utxorpc.Tx {
var txi, txri []*utxorpc.TxInput
var txo []*utxorpc.TxOutput
txi := []*utxorpc.TxInput{}
txri := []*utxorpc.TxInput{}
txo := []*utxorpc.TxOutput{}
for _, i := range b.Inputs() {
input := i.Utxorpc()
txi = append(txi, input)
Expand Down
2 changes: 1 addition & 1 deletion ledger/byron/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (t *ByronTransaction) Consumed() []common.TransactionInput {
}

func (t *ByronTransaction) Produced() []common.Utxo {
var ret []common.Utxo
ret := []common.Utxo{}
for idx, output := range t.Outputs() {
ret = append(
ret,
Expand Down
4 changes: 2 additions & 2 deletions ledger/byron/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (g *ByronGenesis) GenesisUtxos() ([]common.Utxo, error) {
}

func (g *ByronGenesis) avvmUtxos() ([]common.Utxo, error) {
var ret []common.Utxo
ret := []common.Utxo{}
for pubkey, amount := range g.AvvmDistr {
// Build address from redeem pubkey
pubkeyBytes, err := base64.URLEncoding.DecodeString(pubkey)
Expand Down Expand Up @@ -145,7 +145,7 @@ func (g *ByronGenesis) avvmUtxos() ([]common.Utxo, error) {
}

func (g *ByronGenesis) nonAvvmUtxos() ([]common.Utxo, error) {
var ret []common.Utxo
ret := []common.Utxo{}
for address, amount := range g.NonAvvmBalances {
tmpAddr, err := common.NewAddress(address)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions ledger/common/certs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Blink Labs Software
// Copyright 2025 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -480,7 +480,7 @@ func (c *MoveInstantaneousRewardsCertificate) UnmarshalCBOR(
}

func (c *MoveInstantaneousRewardsCertificate) Utxorpc() *utxorpc.Certificate {
var tmpMirTargets []*utxorpc.MirTarget
tmpMirTargets := []*utxorpc.MirTarget{}
for stakeCred, deltaCoin := range c.Reward.Rewards {
tmpMirTargets = append(
tmpMirTargets,
Expand Down
4 changes: 2 additions & 2 deletions ledger/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (m MultiAsset[T]) MarshalJSON() ([]byte, error) {
}

func (m *MultiAsset[T]) Policies() []Blake2b224 {
var ret []Blake2b224
ret := []Blake2b224{}
for policyId := range m.data {
ret = append(ret, policyId)
}
Expand All @@ -195,7 +195,7 @@ func (m *MultiAsset[T]) Assets(policyId Blake2b224) [][]byte {
if !ok {
return nil
}
var ret [][]byte
ret := [][]byte{}
for assetName := range assets {
ret = append(ret, assetName.Bytes())
}
Expand Down
2 changes: 1 addition & 1 deletion ledger/conway/conway.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (b *ConwayBlock) Transactions() []common.Transaction {
}

func (b *ConwayBlock) Utxorpc() *utxorpc.Block {
var txs []*utxorpc.Tx
txs := []*utxorpc.Tx{}
tmpHash, _ := hex.DecodeString(b.Hash())
for _, t := range b.Transactions() {
tx := t.Utxorpc()
Expand Down
4 changes: 2 additions & 2 deletions ledger/mary/mary.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (b *MaryBlock) Transactions() []common.Transaction {
}

func (b *MaryBlock) Utxorpc() *utxorpc.Block {
var txs []*utxorpc.Tx
txs := []*utxorpc.Tx{}
tmpHash, _ := hex.DecodeString(b.Hash())
for _, t := range b.Transactions() {
tx := t.Utxorpc()
Expand Down Expand Up @@ -286,7 +286,7 @@ func (t MaryTransaction) Consumed() []common.TransactionInput {
}

func (t MaryTransaction) Produced() []common.Utxo {
var ret []common.Utxo
ret := []common.Utxo{}
for idx, output := range t.Outputs() {
ret = append(
ret,
Expand Down
2 changes: 1 addition & 1 deletion ledger/mary/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func UtxoValidateOutputTooBigUtxo(
_ common.LedgerState,
_ common.ProtocolParameters,
) error {
var badOutputs []common.TransactionOutput
badOutputs := []common.TransactionOutput{}
for _, txOutput := range tx.Outputs() {
tmpOutput, ok := txOutput.(*MaryTransactionOutput)
if !ok {
Expand Down
6 changes: 3 additions & 3 deletions ledger/shelley/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func UtxoValidateWrongNetwork(
pp common.ProtocolParameters,
) error {
networkId := ls.NetworkId()
var badAddrs []common.Address
badAddrs := []common.Address{}
for _, tmpOutput := range tx.Outputs() {
addr := tmpOutput.Address()
if addr.NetworkId() == networkId {
Expand All @@ -139,7 +139,7 @@ func UtxoValidateWrongNetworkWithdrawal(
pp common.ProtocolParameters,
) error {
networkId := ls.NetworkId()
var badAddrs []common.Address
badAddrs := []common.Address{}
for addr := range tx.Withdrawals() {
if addr.NetworkId() == networkId {
continue
Expand Down Expand Up @@ -224,7 +224,7 @@ func UtxoValidateOutputBootAddrAttrsTooBig(
ls common.LedgerState,
pp common.ProtocolParameters,
) error {
var badOutputs []common.TransactionOutput
badOutputs := []common.TransactionOutput{}
for _, tmpOutput := range tx.Outputs() {
addr := tmpOutput.Address()
if addr.Type() != common.AddressTypeByron {
Expand Down
8 changes: 4 additions & 4 deletions ledger/shelley/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (b *ShelleyBlock) Transactions() []common.Transaction {
}

func (b *ShelleyBlock) Utxorpc() *utxorpc.Block {
var txs []*utxorpc.Tx
txs := []*utxorpc.Tx{}
tmpHash, _ := hex.DecodeString(b.Hash())
for _, t := range b.Transactions() {
tx := t.Utxorpc()
Expand Down Expand Up @@ -330,8 +330,8 @@ func (b *ShelleyTransactionBody) Donation() uint64 {
}

func (b *ShelleyTransactionBody) Utxorpc() *utxorpc.Tx {
var txi []*utxorpc.TxInput
var txo []*utxorpc.TxOutput
txi := []*utxorpc.TxInput{}
txo := []*utxorpc.TxOutput{}
for _, i := range b.Inputs() {
input := i.Utxorpc()
txi = append(txi, input)
Expand Down Expand Up @@ -626,7 +626,7 @@ func (t ShelleyTransaction) Consumed() []common.TransactionInput {
}

func (t ShelleyTransaction) Produced() []common.Utxo {
var ret []common.Utxo
ret := []common.Utxo{}
for idx, output := range t.Outputs() {
ret = append(
ret,
Expand Down
2 changes: 1 addition & 1 deletion ledger/verify_block_body.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func CalculateBlockBodyHash(txsRaw [][]string) ([]byte, error) {
}

func GetTxBodies(txsRaw [][]string) ([]BabbageTransactionBody, error) {
var bodies []BabbageTransactionBody
bodies := []BabbageTransactionBody{}
for index, tx := range txsRaw {
var tmp BabbageTransactionBody
bodyTmpHex := tx[0]
Expand Down