mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
Merge pull request #1250 from maticnetwork/psp-master
Backmerge Master to develop after 1.3.2 release
This commit is contained in:
commit
4170c2756a
11 changed files with 37 additions and 14 deletions
|
|
@ -379,8 +379,8 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu
|
|||
if count == 0 {
|
||||
return rlpHeaders
|
||||
}
|
||||
// read remaining from ancients
|
||||
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 0)
|
||||
// read remaining from ancients, cap at 2M
|
||||
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 2*1024*1024)
|
||||
if err != nil {
|
||||
log.Error("Failed to read headers from freezer", "err", err)
|
||||
return rlpHeaders
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ func rewindBack(eth *Ethereum, head uint64, rewindTo uint64) {
|
|||
}
|
||||
|
||||
func rewind(eth *Ethereum, head uint64, rewindTo uint64) {
|
||||
eth.handler.downloader.Cancel()
|
||||
err := eth.blockchain.SetHead(rewindTo)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1097,7 +1097,13 @@ func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.
|
|||
|
||||
result := make([]map[string]interface{}, len(receipts))
|
||||
for i, receipt := range receipts {
|
||||
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i)
|
||||
result[i] = marshalReceipt(receipt, block.Hash(), block.NumberU64(), signer, txs[i], i, false)
|
||||
}
|
||||
|
||||
stateSyncReceipt := rawdb.ReadBorReceipt(s.b.ChainDb(), block.Hash(), block.NumberU64(), s.b.ChainConfig())
|
||||
if stateSyncReceipt != nil {
|
||||
tx, _, _, _ := rawdb.ReadBorTransaction(s.b.ChainDb(), stateSyncReceipt.TxHash)
|
||||
result = append(result, marshalReceipt(stateSyncReceipt, block.Hash(), block.NumberU64(), signer, tx, len(result), true))
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
|
@ -2118,17 +2124,24 @@ func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.
|
|||
|
||||
// Derive the sender.
|
||||
signer := types.MakeSigner(s.b.ChainConfig(), header.Number, header.Time)
|
||||
return marshalReceipt(receipt, blockHash, blockNumber, signer, tx, int(index)), nil
|
||||
return marshalReceipt(receipt, blockHash, blockNumber, signer, tx, int(index), borTx), nil
|
||||
}
|
||||
|
||||
// marshalReceipt marshals a transaction receipt into a JSON object.
|
||||
func marshalReceipt(receipt *types.Receipt, blockHash common.Hash, blockNumber uint64, signer types.Signer, tx *types.Transaction, txIndex int) map[string]interface{} {
|
||||
func marshalReceipt(receipt *types.Receipt, blockHash common.Hash, blockNumber uint64, signer types.Signer, tx *types.Transaction, txIndex int, borTx bool) map[string]interface{} {
|
||||
from, _ := types.Sender(signer, tx)
|
||||
|
||||
txHash := common.Hash{}
|
||||
if borTx {
|
||||
txHash = types.GetDerivedBorTxHash(types.BorReceiptKey(blockNumber, blockHash))
|
||||
} else {
|
||||
txHash = tx.Hash()
|
||||
}
|
||||
|
||||
fields := map[string]interface{}{
|
||||
"blockHash": blockHash,
|
||||
"blockNumber": hexutil.Uint64(blockNumber),
|
||||
"transactionHash": tx.Hash(),
|
||||
"transactionHash": txHash,
|
||||
"transactionIndex": hexutil.Uint64(txIndex),
|
||||
"from": from,
|
||||
"to": tx.To(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Source: bor-profile
|
||||
Version: 1.3.1
|
||||
Version: 1.3.2
|
||||
Section: develop
|
||||
Priority: standard
|
||||
Maintainer: Polygon <release-team@polygon.technology>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 1 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 1 // Patch version component of the current release
|
||||
VersionPatch = 2 // Patch version component of the current release
|
||||
VersionMeta = "" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,15 @@ func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi
|
|||
assert.Equal(t, 2, len(receiptsOut))
|
||||
assert.True(t, areDifferentHashes(receiptsOut))
|
||||
|
||||
// check 5: Tx hash for state sync txn
|
||||
block, err := publicBlockchainAPI.GetBlockByNumber(context.Background(), rpc.BlockNumber(4), false)
|
||||
assert.Nil(t, err)
|
||||
blockHash := block["hash"].(common.Hash)
|
||||
txHash := types.GetDerivedBorTxHash(types.BorReceiptKey(4, blockHash))
|
||||
// Compare tx hash from GetTransactionReceiptsByBlock with hash computed above
|
||||
txReceipts, err := publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(4))
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, txHash, txReceipts[1]["transactionHash"].(common.Hash))
|
||||
}
|
||||
|
||||
// Test for GetTransactionByBlockNumberAndIndex
|
||||
|
|
@ -122,7 +131,7 @@ func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPool
|
|||
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 0)
|
||||
assert.Equal(t, common.HexToAddress("0x1000"), *tx.To)
|
||||
|
||||
// check 5 : Normal Transaction
|
||||
// check 5 : State Sync Transaction
|
||||
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 1)
|
||||
assert.Equal(t, common.HexToAddress("0x0"), *tx.To)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue