backend icon indicating copy to clipboard operation
backend copied to clipboard

Is this expected Behaviour in /v0/send-bitclout?

Open jagathks opened this issue 4 years ago • 5 comments

I was running bit clout on my local machine in TESTNET mode, and i am trying out different API's from Backend API List through postman. Everything is working great when i call

api/v0/send-bitclout

I get an response, but immediately when i try to call next API

api/v0/submit-transaction

with transactionhex as input

i am getting

{ "error": "SubmitTransaction: Problem processing transaction: VerifyAndBroadcastTransaction: Problem validating txn: ValidateTransaction: Problem validating transaction: : ConnectTransaction: : _connectBasicTransfer: Problem verifying txn signature: : RuleErrorInvalidTransactionSignature" }

when try to log few transaction data on my console i noticed below output is getting printed:

< TxHash: f285f5199b27eac5f40e9b2d194628c3d3d2612b667e4bd5a496e7e264c95c2e, TxnType: BC1YLgJxJq5BHAMhmcWjAxKjphgXE7fogodt1RDk9jhGWTLPz1j3qHP, PubKey: BASIC_TRANSFER >

here you can see

PubKey -> is having transaction type value and TxnType is having public key

it just swapped the data which is strange, i don't understand how this is happening? can someone shed some light here please?

Above log is printed when calling "/send-bitclout" API, inside "SendBitClout" method call -> above line #987. File: routes/transaction.go#L987

jagathks avatar Sep 02 '21 14:09 jagathks

Did you sign the transaction hex before sending it to submit-transaction, or just lift it directly off the send-bitclout response?

andyboyd avatar Sep 02 '21 15:09 andyboyd

Did you sign the transaction hex before sending it to submit-transaction, or just lift it directly off the send-bitclout response?

That's the exact issue.. Thanks for pointing out.. :) Just figured out by running frontend on my local machine. Everything works smooth.. but i still don't get why the keys are swapped?

jagathks avatar Sep 02 '21 17:09 jagathks

My guess is that's a typo in the logging code somewhere, it definitely shouldn't be like that.

andyboyd avatar Sep 02 '21 18:09 andyboyd

I am not doing anything extra here! i am just printing txnn.. glog.Infof("========raw data Just before Sanity check=========: %v", txnn)

jagathks avatar Sep 02 '21 18:09 jagathks

The transaction String() method has these parameters swapped. It's an easy fix in the core repo if you want to try it :)

maebeam avatar Sep 06 '21 11:09 maebeam