mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Update api.go
This commit is contained in:
parent
a9eaf2ffd8
commit
0ef42ae99a
1 changed files with 19 additions and 18 deletions
|
|
@ -1644,6 +1644,19 @@ func (api *TransactionAPI) currentBlobSidecarVersion() byte {
|
||||||
}
|
}
|
||||||
return types.BlobSidecarVersion0
|
return types.BlobSidecarVersion0
|
||||||
}
|
}
|
||||||
|
// convertLegacyBlobSidecar upgrades a legacy blob sidecar to the expected version.
|
||||||
|
func (api *TransactionAPI) convertLegacyBlobSidecar(tx *types.Transaction) (*types.Transaction, error) {
|
||||||
|
if sc := tx.BlobTxSidecar(); sc != nil {
|
||||||
|
exp := api.currentBlobSidecarVersion()
|
||||||
|
if sc.Version == types.BlobSidecarVersion0 && exp == types.BlobSidecarVersion1 {
|
||||||
|
if err := sc.ToV1(); err != nil {
|
||||||
|
return nil, fmt.Errorf("blob sidecar conversion failed: %v", err)
|
||||||
|
}
|
||||||
|
tx = tx.WithBlobTxSidecar(sc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tx, nil
|
||||||
|
}
|
||||||
|
|
||||||
// SendRawTransaction will add the signed transaction to the transaction pool.
|
// SendRawTransaction will add the signed transaction to the transaction pool.
|
||||||
// The sender is responsible for signing the transaction and using the correct nonce.
|
// The sender is responsible for signing the transaction and using the correct nonce.
|
||||||
|
|
@ -1654,15 +1667,9 @@ func (api *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert legacy blob transaction proofs.
|
// Convert legacy blob transaction proofs.
|
||||||
// TODO: remove in go-ethereum v1.17.x
|
var err error
|
||||||
if sc := tx.BlobTxSidecar(); sc != nil {
|
if tx, err = api.convertLegacyBlobSidecar(tx); err != nil {
|
||||||
exp := api.currentBlobSidecarVersion()
|
return common.Hash{}, err
|
||||||
if sc.Version == types.BlobSidecarVersion0 && exp == types.BlobSidecarVersion1 {
|
|
||||||
if err := sc.ToV1(); err != nil {
|
|
||||||
return common.Hash{}, fmt.Errorf("blob sidecar conversion failed: %v", err)
|
|
||||||
}
|
|
||||||
tx = tx.WithBlobTxSidecar(sc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SubmitTransaction(ctx, api.b, tx)
|
return SubmitTransaction(ctx, api.b, tx)
|
||||||
|
|
@ -1677,15 +1684,9 @@ func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert legacy blob transaction proofs.
|
// Convert legacy blob transaction proofs.
|
||||||
// TODO: remove in go-ethereum v1.17.x
|
var err error
|
||||||
if sc := tx.BlobTxSidecar(); sc != nil {
|
if tx, err = api.convertLegacyBlobSidecar(tx); err != nil {
|
||||||
exp := api.currentBlobSidecarVersion()
|
return nil, err
|
||||||
if sc.Version == types.BlobSidecarVersion0 && exp == types.BlobSidecarVersion1 {
|
|
||||||
if err := sc.ToV1(); err != nil {
|
|
||||||
return nil, fmt.Errorf("blob sidecar conversion failed: %v", err)
|
|
||||||
}
|
|
||||||
tx = tx.WithBlobTxSidecar(sc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ch := make(chan core.ChainEvent, 128)
|
ch := make(chan core.ChainEvent, 128)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue