diff --git a/client/client.go b/client/client.go index 24a1384ac71cd92c7d51e3152da37a852164472c..16588f53d2b2991025d34cc8ba06e14438aed858 100644 --- a/client/client.go +++ b/client/client.go @@ -100,7 +100,7 @@ func (erisNodeClient *ErisNodeClient) Status() (GenesisHash []byte, ValidatorPub func (erisNodeClient *ErisNodeClient) ChainId() (ChainName, ChainId string, GenesisHash []byte, err error) { client := rpcclient.NewClientJSONRPC(erisNodeClient.broadcastRPC) - chainIdResult, err := tendermint_client.ChainId() + chainIdResult, err := tendermint_client.ChainId(client) if err != nil { err = fmt.Errorf("Error connecting to node (%s) to get chain id: %s", erisNodeClient.broadcastRPC, err.Error()) diff --git a/client/core/transaction_factory.go b/client/core/transaction_factory.go index af1bcd00bdfd93a59898f9efd87627c5602bf7bc..e631144c11bc36f70327b86488bd0ce66347564c 100644 --- a/client/core/transaction_factory.go +++ b/client/core/transaction_factory.go @@ -22,11 +22,11 @@ import ( "strconv" // "strings" // "time" + log "github.com/eris-ltd/eris-logger" ptypes "github.com/eris-ltd/eris-db/permission/types" - // log "github.com/eris-ltd/eris-logger" - + "github.com/eris-ltd/eris-db/account" "github.com/eris-ltd/eris-db/client" "github.com/eris-ltd/eris-db/keys" "github.com/eris-ltd/eris-db/txs" @@ -281,9 +281,7 @@ func SignAndBroadcast(chainID string, nodeClient client.NodeClient, keyClient ke return nil, err } log.WithFields(log.Fields{ - "transaction sign bytes": fmt.Sprintf("%X", signBytes), - "account address": fmt.Sprintf("%X", inputAddr), - "signature": fmt.Sprintf("%X", sig64), + "transaction": string(account.SignBytes(chainID, tx)), }).Debug("Signed transaction") } diff --git a/client/core/transaction_factory_test.go b/client/core/transaction_factory_test.go index f480fcaf57d68df6f1e99bfcc69977b1f7b7958b..4544655e1d045332e07678a772b09a1c267b155b 100644 --- a/client/core/transaction_factory_test.go +++ b/client/core/transaction_factory_test.go @@ -20,6 +20,8 @@ import ( "fmt" "testing" + // "github.com/stretchr/testify/assert" + mockclient "github.com/eris-ltd/eris-db/client/mock" mockkeys "github.com/eris-ltd/eris-db/keys/mock" ) @@ -60,6 +62,7 @@ func testTransactionFactorySend(t *testing.T, t.Logf("Error in SendTx: %s", err) t.Fail() } + // assert.NotEqual(t, txSend) // TODO: test content of Transaction } diff --git a/client/methods/status.go b/client/methods/status.go index 63046f6d9a3118f0a18f93357bb52f30f17fb664..2954fd1d283c759e24eabf66ed6499fd74ff397f 100644 --- a/client/methods/status.go +++ b/client/methods/status.go @@ -27,17 +27,27 @@ import ( func Status(do *definitions.ClientDo) { erisNodeClient := client.NewErisNodeClient(do.NodeAddrFlag) - chainId, validatorPublicKey, latestBlockHash, latestBlockHeight, latestBlockTime, err := erisNodeClient.Status() + genesisHash, validatorPublicKey, latestBlockHash, latestBlockHeight, latestBlockTime, err := erisNodeClient.Status() if err != nil { log.Errorf("Error requesting status from chain at (%s): %s", do.NodeAddrFlag, err) return - } + } + + chainName, chainId, genesisHashfromChainId, err := erisNodeClient.ChainId() + if err != nil { + log.Errorf("Error requesting chainId from chain at (%s): %s", do.NodeAddrFlag, err) + return + } + log.WithFields(log.Fields{ "chain": do.NodeAddrFlag, - "chainid": fmt.Sprintf("%X", chainId), + "genesisHash": fmt.Sprintf("%X", genesisHash), + "chainName": chainName, + "chainId": chainId, + "genesisHash from chainId":fmt.Sprintf("%X", genesisHashfromChainId), "validator public key": fmt.Sprintf("%X", validatorPublicKey), "latest block hash": fmt.Sprintf("%X", latestBlockHash), "latest block height": latestBlockHeight, "latest block time": latestBlockTime, }).Info("status") -} \ No newline at end of file +} diff --git a/definitions/tendermint_pipe.go b/definitions/tendermint_pipe.go index 37973ce4dcaffc918d477a19d809ae1a7d808175..e933194d7cb28c1f2bbb163f0ef9b0009d4509f6 100644 --- a/definitions/tendermint_pipe.go +++ b/definitions/tendermint_pipe.go @@ -41,6 +41,7 @@ type TendermintPipe interface { Status() (*rpc_tm_types.ResultStatus, error) NetInfo() (*rpc_tm_types.ResultNetInfo, error) Genesis() (*rpc_tm_types.ResultGenesis, error) + ChainId() (*rpc_tm_types.ResultChainId, error) // Accounts GetAccount(address []byte) (*rpc_tm_types.ResultGetAccount, error) diff --git a/manager/eris-mint/pipe.go b/manager/eris-mint/pipe.go index e38592b689bbea9c2eeb605efda5f0c16a32cb04..b8cc00c64ec94bb097a43d5871d0dbb5f22ad64a 100644 --- a/manager/eris-mint/pipe.go +++ b/manager/eris-mint/pipe.go @@ -311,13 +311,13 @@ func (pipe *erisMintPipe) ChainId() (*rpc_tm_types.ResultChainId, error) { if pipe.blockchain == nil { return nil, fmt.Errorf("Blockchain not initialised in Erismint pipe.") } - chainId := pipe.blockchain().ChainId() + chainId := pipe.blockchain.ChainId() return &rpc_tm_types.ResultChainId{ ChainName: chainId, // MARMOT: copy ChainId for ChainName as a placehodlder ChainId: chainId, GenesisHash: pipe.GenesisHash(), - } + }, nil } func (pipe *erisMintPipe) NetInfo() (*rpc_tm_types.ResultNetInfo, error) { diff --git a/rpc/tendermint/client/client.go b/rpc/tendermint/client/client.go index 2de60d1a6c2e495101ba2992bff047fbaf603d27..3da5a1286d8c2aeaf31b28b2b97cc29da32d3a8a 100644 --- a/rpc/tendermint/client/client.go +++ b/rpc/tendermint/client/client.go @@ -20,7 +20,7 @@ func Status(client rpcclient.Client) (*rpc_types.ResultStatus, error) { return res.(*rpc_types.ResultStatus), nil } -func ChainId(client rpcclient.Client) (*rpc_types.ResultChainId) { +func ChainId(client rpcclient.Client) (*rpc_types.ResultChainId, error) { res, err := performCall(client, "chain_id") if err != nil { return nil, err diff --git a/rpc/tendermint/core/types/responses.go b/rpc/tendermint/core/types/responses.go index 304fe38bd234175f61349fd2e832004d729f8e6e..daa053e661e9126f745897e0713e77864508195b 100644 --- a/rpc/tendermint/core/types/responses.go +++ b/rpc/tendermint/core/types/responses.go @@ -62,7 +62,7 @@ type ResultStatus struct { type ResultChainId struct { ChainName string `json:"chain_name"` - ChainID string `json:"chain_id"` + ChainId string `json:"chain_id"` GenesisHash []byte `json:"genesis_hash"` }