fixes after rebase

This commit is contained in:
Ian Norden 2019-08-29 14:57:58 -05:00
parent d2db5d0ac9
commit 8b31d12716
14 changed files with 29 additions and 8 deletions

View File

@ -69,7 +69,11 @@ func syncAndPublish() {
}
ipfsPath = filepath.Join(home, ".ipfs")
}
processor, err := seed_node.NewSeedNode(ipfsPath, &db, rpcClient, quitChan, 1)
workers := viper.GetInt("client.workers")
if workers < 1 {
workers = 1
}
processor, err := seed_node.NewSeedNode(ipfsPath, &db, rpcClient, quitChan, workers)
if err != nil {
log.Fatal(err)
}

View File

@ -63,7 +63,11 @@ func syncPublishScreenAndServe() {
}
ipfsPath = filepath.Join(home, ".ipfs")
}
processor, err := seed_node.NewSeedNode(ipfsPath, &db, rpcClient, quitChan, 1)
workers := viper.GetInt("client.workers")
if workers < 1 {
workers = 1
}
processor, err := seed_node.NewSeedNode(ipfsPath, &db, rpcClient, quitChan, workers)
if err != nil {
log.Fatal(err)
}

View File

@ -76,7 +76,7 @@ var _ = Describe("Conversion of GethBlock to core.Block", func() {
Expect(coreBlock.ParentHash).To(Equal(block.ParentHash().Hex()))
Expect(coreBlock.ExtraData).To(Equal(hexutil.Encode(block.Extra())))
Expect(coreBlock.Size).To(Equal(block.Size().String()))
Expect(coreBlock.Time).To(Equal(int64(time)))
Expect(coreBlock.Time).To(Equal(time))
Expect(coreBlock.UncleHash).To(Equal(block.UncleHash().Hex()))
Expect(coreBlock.IsFinal).To(BeFalse())
})

View File

@ -208,7 +208,7 @@ var (
BlockNumber: "1",
BlockHash: MockBlock.Hash(),
HeaderCID: "mockHeaderCID",
UncleCIDS: make(map[common.Hash]string),
UncleCIDs: make(map[common.Hash]string),
TransactionCIDs: map[common.Hash]*ipfs.TrxMetaData{
MockTransactions[0].Hash(): {
CID: "mockTrxCID1",

View File

@ -125,7 +125,7 @@ func (pub *Publisher) Publish(payload *IPLDPayload) (*CIDPayload, error) {
BlockHash: payload.BlockHash,
BlockNumber: payload.BlockNumber.String(),
HeaderCID: headerCid,
UncleCIDS: uncleCids,
UncleCIDs: uncleCids,
TransactionCIDs: transactionCids,
ReceiptCIDs: receiptsCids,
StateNodeCIDs: stateNodeCids,

View File

@ -57,7 +57,20 @@ var _ = Describe("Publisher", func() {
}
cidPayload, err := publisher.Publish(mocks.MockIPLDPayload)
Expect(err).ToNot(HaveOccurred())
Expect(*cidPayload).To(Equal(*mocks.MockCIDPayload))
Expect(cidPayload.BlockNumber).To(Equal(mocks.MockCIDPayload.BlockNumber))
Expect(cidPayload.BlockHash).To(Equal(mocks.MockCIDPayload.BlockHash))
Expect(cidPayload.UncleCIDs).To(Equal(mocks.MockCIDPayload.UncleCIDs))
Expect(cidPayload.HeaderCID).To(Equal(mocks.MockCIDPayload.HeaderCID))
Expect(len(cidPayload.TransactionCIDs)).To(Equal(2))
Expect(cidPayload.TransactionCIDs[mocks.MockTransactions[0].Hash()]).To(Equal(mocks.MockCIDPayload.TransactionCIDs[mocks.MockTransactions[0].Hash()]))
Expect(cidPayload.TransactionCIDs[mocks.MockTransactions[1].Hash()]).To(Equal(mocks.MockCIDPayload.TransactionCIDs[mocks.MockTransactions[1].Hash()]))
Expect(len(cidPayload.ReceiptCIDs)).To(Equal(2))
Expect(cidPayload.ReceiptCIDs[mocks.MockTransactions[0].Hash()]).To(Equal(mocks.MockCIDPayload.ReceiptCIDs[mocks.MockTransactions[0].Hash()]))
Expect(cidPayload.ReceiptCIDs[mocks.MockTransactions[1].Hash()]).To(Equal(mocks.MockCIDPayload.ReceiptCIDs[mocks.MockTransactions[1].Hash()]))
Expect(len(cidPayload.StateNodeCIDs)).To(Equal(2))
Expect(cidPayload.StateNodeCIDs[mocks.ContractLeafKey]).To(Equal(mocks.MockCIDPayload.StateNodeCIDs[mocks.ContractLeafKey]))
Expect(cidPayload.StateNodeCIDs[mocks.AnotherContractLeafKey]).To(Equal(mocks.MockCIDPayload.StateNodeCIDs[mocks.AnotherContractLeafKey]))
Expect(cidPayload.StorageNodeCIDs).To(Equal(mocks.MockCIDPayload.StorageNodeCIDs))
})
})
})

View File

@ -77,7 +77,7 @@ type CIDPayload struct {
BlockNumber string
BlockHash common.Hash
HeaderCID string
UncleCIDS map[common.Hash]string
UncleCIDs map[common.Hash]string
TransactionCIDs map[common.Hash]*TrxMetaData
ReceiptCIDs map[common.Hash]*ReceiptMetaData
StateNodeCIDs map[common.Hash]StateNodeCID

View File

@ -56,7 +56,7 @@ func (repo *Repository) Index(cidPayload *ipfs.CIDPayload) error {
}
return err
}
for uncleHash, cid := range cidPayload.UncleCIDS {
for uncleHash, cid := range cidPayload.UncleCIDs {
err = repo.indexUncleCID(tx, cid, cidPayload.BlockNumber, uncleHash.Hex())
if err != nil {
rollbackErr := tx.Rollback()