mv of babyjub.PublicKey to babyjub.PublicKeyComp

Update usage of `*babyjub.PublicKey` to `babyjub.PublicKeyComp`
- when the key is not defined, internally is used `babyjub.EmptyBJJComp`, which is a `[32]byte` of zeroes of type `babyjub.PublicKeyComp`
- the API continues returning `nil` when the key is not defined
This commit is contained in:
arnaucube
2020-12-18 17:19:07 +01:00
parent b9943182b8
commit 4b10549822
47 changed files with 761 additions and 733 deletions

View File

@@ -88,14 +88,12 @@ func (l2db *L2DB) AddTxTest(tx *common.PoolL2Tx) error {
insertTx := &PoolL2TxWrite{
TxID: tx.TxID,
FromIdx: tx.FromIdx,
ToBJJ: tx.ToBJJ,
TokenID: tx.TokenID,
Amount: tx.Amount,
Fee: tx.Fee,
Nonce: tx.Nonce,
State: common.PoolL2TxStatePending,
Signature: tx.Signature,
RqToBJJ: tx.RqToBJJ,
RqAmount: tx.RqAmount,
Type: tx.Type,
}
@@ -118,6 +116,12 @@ func (l2db *L2DB) AddTxTest(tx *common.PoolL2Tx) error {
if tx.RqToEthAddr != nilAddr {
insertTx.RqToEthAddr = &tx.RqToEthAddr
}
if tx.ToBJJ != common.EmptyBJJComp {
insertTx.ToBJJ = &tx.ToBJJ
}
if tx.RqToBJJ != common.EmptyBJJComp {
insertTx.RqToBJJ = &tx.RqToBJJ
}
f := new(big.Float).SetInt(tx.Amount)
amountF, _ := f.Float64()
insertTx.AmountFloat = amountF