mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-10 18:16:07 +00:00
rpc: cleanup, more tests, working http and jsonrpc
This commit is contained in:
+6
-6
@@ -12,29 +12,29 @@ import (
|
||||
|
||||
type Receipt struct {
|
||||
TxHash []byte
|
||||
CreatesContract bool
|
||||
CreatesContract uint8
|
||||
ContractAddr []byte
|
||||
}
|
||||
|
||||
// pass pointer?
|
||||
// Note: tx must be signed
|
||||
func BroadcastTx(tx types.Tx) (*Receipt, error) {
|
||||
func BroadcastTx(tx types.Tx) (Receipt, error) {
|
||||
err := mempoolReactor.BroadcastTx(tx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error broadcasting transaction: %v", err)
|
||||
return Receipt{}, fmt.Errorf("Error broadcasting transaction: %v", err)
|
||||
}
|
||||
|
||||
txHash := merkle.HashFromBinary(tx)
|
||||
var createsContract bool
|
||||
var createsContract uint8
|
||||
var contractAddr []byte
|
||||
// check if creates new contract
|
||||
if callTx, ok := tx.(*types.CallTx); ok {
|
||||
if callTx.Address == nil {
|
||||
createsContract = true
|
||||
createsContract = 1
|
||||
contractAddr = state.NewContractAddress(callTx.Input.Address, uint64(callTx.Input.Sequence))
|
||||
}
|
||||
}
|
||||
return &Receipt{txHash, createsContract, contractAddr}, nil
|
||||
return Receipt{txHash, createsContract, contractAddr}, nil
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user