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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.24.1
require (
github.com/SundaeSwap-finance/kugo v1.1.0
github.com/SundaeSwap-finance/ogmigo v0.9.0
github.com/blinklabs-io/gouroboros v0.115.2
github.com/blinklabs-io/gouroboros v0.116.0
github.com/btcsuite/btcd/btcutil v1.1.6
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4
github.com/gin-gonic/gin v1.10.0
Expand Down Expand Up @@ -37,7 +37,7 @@ require (
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.8.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ github.com/SundaeSwap-finance/ogmigo v0.9.0/go.mod h1:io/H+NvaSomJKmh4mbhjgT0RX4
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/blinklabs-io/gouroboros v0.115.2 h1:qG6uu8yDQpJ4VYmiARdkOpfjvKw3r0MG4B6dFaZ8Rzc=
github.com/blinklabs-io/gouroboros v0.115.2/go.mod h1:E43ihaCCqNYMsTtdGbTv6Un0QVYcSXb3E/SbADJNBIM=
github.com/blinklabs-io/gouroboros v0.116.0 h1:B+2HUCdMgu1TRlME1Y1ds+nhzmgKLuJwdq7nfSJta08=
github.com/blinklabs-io/gouroboros v0.116.0/go.mod h1:g4e4aqLWcsRCgwk1KLq49CJF4uNq/ZXAp4Z63BbSo4o=
github.com/blinklabs-io/ouroboros-mock v0.3.7 h1:86FvD591XhdGk2BqQweRKfwc6Y6ll5Lunmo/RUehJ6o=
github.com/blinklabs-io/ouroboros-mock v0.3.7/go.mod h1:611xZgdWCxZsSaS5tjgxqjmWIkSpsM9eKuQAKozw+sk=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
Expand Down Expand Up @@ -59,8 +59,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/fxamacker/cbor/v2 v2.8.0 h1:fFtUGXUzXPHTIUdne5+zzMPTfffl3RD5qYnkY40vtxU=
github.com/fxamacker/cbor/v2 v2.8.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 h1:ygs9POGDQpQGLJPlq4+0LBUmMBNox1N4JSpw+OETcvI=
Expand Down
2 changes: 1 addition & 1 deletion input/chainsync/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func NewBlockEvent(block ledger.Block, includeCbor bool) BlockEvent {
evt := BlockEvent{
Block: block,
BlockBodySize: block.BlockBodySize(),
BlockHash: block.Hash(),
BlockHash: block.Hash().String(),
IssuerVkey: block.IssuerVkey().Hash().String(),
TransactionCount: uint64(len(block.Transactions())),
}
Expand Down
28 changes: 14 additions & 14 deletions input/chainsync/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func (m MockIssuerVkey) Hash() []byte {

// MockBlockHeader implements BlockHeader interface
type MockBlockHeader struct {
hash string
prevHash string
hash common.Blake2b256
prevHash common.Blake2b256
blockNumber uint64
slotNumber uint64
issuerVkey common.IssuerVkey
Expand All @@ -31,11 +31,11 @@ type MockBlockHeader struct {
cborBytes []byte
}

func (m MockBlockHeader) Hash() string {
func (m MockBlockHeader) Hash() common.Blake2b256 {
return m.hash
}

func (m MockBlockHeader) PrevHash() string {
func (m MockBlockHeader) PrevHash() common.Blake2b256 {
return m.prevHash
}

Expand Down Expand Up @@ -127,8 +127,8 @@ func TestNewBlockContext(t *testing.T) {
era: common.Era{
Name: "Shelley",
},
hash: "sample-hash-shelley",
prevHash: "prev-hash-shelley",
hash: common.NewBlake2b256([]byte("sample-hash-shelley")),
prevHash: common.NewBlake2b256([]byte("prev-hash-shelley")),
blockBodySize: 1024,
cborBytes: []byte{0x01, 0x02, 0x03},
},
Expand All @@ -148,8 +148,8 @@ func TestNewBlockContext(t *testing.T) {
era: common.Era{
Name: "Allegra",
},
hash: "another-hash-allegra",
prevHash: "prev-hash-allegra",
hash: common.NewBlake2b256([]byte("another-hash-allegra")),
prevHash: common.NewBlake2b256([]byte("prev-hash-allegra")),
blockBodySize: 2048,
cborBytes: []byte{0x04, 0x05, 0x06},
},
Expand All @@ -169,8 +169,8 @@ func TestNewBlockContext(t *testing.T) {
era: common.Era{
Name: "Mary",
},
hash: "mary-block-hash",
prevHash: "prev-hash-mary",
hash: common.NewBlake2b256([]byte("mary-block-hash")),
prevHash: common.NewBlake2b256([]byte("prev-hash-mary")),
blockBodySize: 4096,
cborBytes: []byte{0x07, 0x08, 0x09},
},
Expand Down Expand Up @@ -230,8 +230,8 @@ func TestNewBlockContextEdgeCases(t *testing.T) {
era: common.Era{
Name: "",
},
hash: "",
prevHash: "",
hash: common.Blake2b256{},
prevHash: common.Blake2b256{},
blockBodySize: 0,
cborBytes: []byte{},
},
Expand All @@ -249,8 +249,8 @@ func TestNewBlockContextEdgeCases(t *testing.T) {
era: common.Era{
Name: "Alonzo",
},
hash: "max-block-hash",
prevHash: "max-prev-hash",
hash: common.NewBlake2b256([]byte("max-block-hash")),
prevHash: common.NewBlake2b256([]byte("max-prev-hash")),
blockBodySize: ^uint64(0),
cborBytes: []byte{0x0A, 0x0B, 0x0C},
},
Expand Down
9 changes: 4 additions & 5 deletions input/chainsync/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,10 @@ func (c *ChainSync) handleRollForward(
case ledger.Block:
evt := event.New("chainsync.block", time.Now(), NewBlockContext(v, c.networkMagic), NewBlockEvent(v, c.includeCbor))
c.eventChan <- evt
c.updateStatus(v.SlotNumber(), v.BlockNumber(), v.Hash(), tip.Point.Slot, hex.EncodeToString(tip.Point.Hash))
c.updateStatus(v.SlotNumber(), v.BlockNumber(), v.Hash().String(), tip.Point.Slot, hex.EncodeToString(tip.Point.Hash))
case ledger.BlockHeader:
blockSlot := v.SlotNumber()
blockHash, _ := hex.DecodeString(v.Hash())
block, err := c.oConn.BlockFetch().Client.GetBlock(ocommon.Point{Slot: blockSlot, Hash: blockHash})
block, err := c.oConn.BlockFetch().Client.GetBlock(ocommon.Point{Slot: blockSlot, Hash: v.Hash().Bytes()})
if err != nil {
return err
}
Expand All @@ -352,7 +351,7 @@ func (c *ChainSync) handleRollForward(
NewTransactionEvent(block, transaction, c.includeCbor, resolvedInputs))
c.eventChan <- txEvt
}
c.updateStatus(v.SlotNumber(), v.BlockNumber(), v.Hash(), tip.Point.Slot, hex.EncodeToString(tip.Point.Hash))
c.updateStatus(v.SlotNumber(), v.BlockNumber(), v.Hash().String(), tip.Point.Slot, hex.EncodeToString(tip.Point.Hash))
}
return nil
}
Expand Down Expand Up @@ -398,7 +397,7 @@ func (c *ChainSync) handleBlockFetchBlock(
c.updateStatus(
block.SlotNumber(),
block.BlockNumber(),
block.Hash(),
block.Hash().String(),
c.bulkRangeEnd.Slot,
hex.EncodeToString(c.bulkRangeEnd.Hash),
)
Expand Down
4 changes: 2 additions & 2 deletions input/chainsync/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewTransactionContext(
ctx := TransactionContext{
BlockNumber: block.BlockNumber(),
SlotNumber: block.SlotNumber(),
TransactionHash: tx.Hash(),
TransactionHash: tx.Hash().String(),
TransactionIdx: index,
NetworkMagic: networkMagic,
}
Expand All @@ -66,7 +66,7 @@ func NewTransactionEvent(
) TransactionEvent {
evt := TransactionEvent{
Transaction: tx,
BlockHash: block.Hash(),
BlockHash: block.Hash().String(),
Inputs: tx.Inputs(),
Outputs: tx.Outputs(),
Fee: tx.Fee(),
Expand Down
Loading