|
|
@ -235,7 +235,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big |
|
|
|
|
|
|
|
|
|
|
|
// This puts transactions in a extra db for rpc
|
|
|
|
// This puts transactions in a extra db for rpc
|
|
|
|
for i, tx := range block.Transactions() { |
|
|
|
for i, tx := range block.Transactions() { |
|
|
|
putTx(sm.extraDb, tx, block, i) |
|
|
|
putTx(sm.extraDb, tx, block, uint64(i)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if uncle { |
|
|
|
if uncle { |
|
|
@ -359,7 +359,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro |
|
|
|
return state.Logs(), nil |
|
|
|
return state.Logs(), nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func putTx(db common.Database, tx *types.Transaction, block *types.Block, i int) { |
|
|
|
func putTx(db common.Database, tx *types.Transaction, block *types.Block, i uint64) { |
|
|
|
rlpEnc, err := rlp.EncodeToBytes(tx) |
|
|
|
rlpEnc, err := rlp.EncodeToBytes(tx) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
statelogger.Infoln("Failed encoding tx", err) |
|
|
|
statelogger.Infoln("Failed encoding tx", err) |
|
|
@ -367,24 +367,18 @@ func putTx(db common.Database, tx *types.Transaction, block *types.Block, i int) |
|
|
|
} |
|
|
|
} |
|
|
|
db.Put(tx.Hash().Bytes(), rlpEnc) |
|
|
|
db.Put(tx.Hash().Bytes(), rlpEnc) |
|
|
|
|
|
|
|
|
|
|
|
rlpEnc, err = rlp.EncodeToBytes(block.Hash().Bytes()) |
|
|
|
var txExtra struct { |
|
|
|
if err != nil { |
|
|
|
BlockHash common.Hash |
|
|
|
statelogger.Infoln("Failed encoding meta", err) |
|
|
|
BlockIndex uint64 |
|
|
|
return |
|
|
|
Index uint64 |
|
|
|
} |
|
|
|
} |
|
|
|
db.Put(append(tx.Hash().Bytes(), 0x0001), rlpEnc) |
|
|
|
txExtra.BlockHash = block.Hash() |
|
|
|
|
|
|
|
txExtra.BlockIndex = block.NumberU64() |
|
|
|
rlpEnc, err = rlp.EncodeToBytes(block.Number().Bytes()) |
|
|
|
txExtra.Index = i |
|
|
|
if err != nil { |
|
|
|
rlpMeta, err := rlp.EncodeToBytes(txExtra) |
|
|
|
statelogger.Infoln("Failed encoding meta", err) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
db.Put(append(tx.Hash().Bytes(), 0x0002), rlpEnc) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rlpEnc, err = rlp.EncodeToBytes(i) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
statelogger.Infoln("Failed encoding meta", err) |
|
|
|
statelogger.Infoln("Failed encoding meta", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
db.Put(append(tx.Hash().Bytes(), 0x0003), rlpEnc) |
|
|
|
db.Put(append(tx.Hash().Bytes(), 0x0001), rlpMeta) |
|
|
|
} |
|
|
|
} |
|
|
|