Merge branch 'rav001' into rvv001
- Fix transaction fee calculation
This commit is contained in:
commit
0d03c3bffa
2 changed files with 36 additions and 9 deletions
|
@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `getoperationstatus` RPC method
|
- `getoperationstatus` RPC method
|
||||||
- `sendmany` RPC method
|
- `sendmany` RPC method
|
||||||
- Function `prepareTxV2` implementing `PrivacyPolicy`
|
- Function `prepareTxV2` implementing `PrivacyPolicy`
|
||||||
|
- Functionality to shield transparent balance
|
||||||
|
- Functionality to de-shield shielded notes
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -827,7 +827,6 @@ shieldTransparentNotes pool zebraHost zebraPort znet za bh = do
|
||||||
dRecvs
|
dRecvs
|
||||||
forM fNotes $ \trNotes -> do
|
forM fNotes $ \trNotes -> do
|
||||||
let noteTotal = getTotalAmount (trNotes, [], [])
|
let noteTotal = getTotalAmount (trNotes, [], [])
|
||||||
let fee = calculateTxFee (trNotes, [], []) 4
|
|
||||||
tSpends <-
|
tSpends <-
|
||||||
liftIO $
|
liftIO $
|
||||||
prepTSpends
|
prepTSpends
|
||||||
|
@ -839,12 +838,38 @@ shieldTransparentNotes pool zebraHost zebraPort znet za bh = do
|
||||||
let oRcvr =
|
let oRcvr =
|
||||||
fromJust $
|
fromJust $
|
||||||
o_rec =<< isValidUnifiedAddress (E.encodeUtf8 internalUA)
|
o_rec =<< isValidUnifiedAddress (E.encodeUtf8 internalUA)
|
||||||
let snote =
|
let dummy =
|
||||||
OutgoingNote
|
OutgoingNote
|
||||||
4
|
4
|
||||||
(getBytes $ getOrchSK $ zcashAccountOrchSpendKey $ entityVal acc)
|
(getBytes $ getOrchSK $ zcashAccountOrchSpendKey $ entityVal acc)
|
||||||
(getBytes oRcvr)
|
(getBytes oRcvr)
|
||||||
(fromIntegral $ noteTotal - fee)
|
(fromIntegral $ noteTotal - 5000)
|
||||||
|
""
|
||||||
|
True
|
||||||
|
let feeResponse =
|
||||||
|
createTransaction
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
tSpends
|
||||||
|
[]
|
||||||
|
[]
|
||||||
|
[dummy]
|
||||||
|
znet
|
||||||
|
bh
|
||||||
|
False
|
||||||
|
case feeResponse of
|
||||||
|
Left e1 -> return $ Left Fee
|
||||||
|
Right fee -> do
|
||||||
|
let feeAmt =
|
||||||
|
fromIntegral
|
||||||
|
(runGet getInt64le $ LBS.fromStrict $ toBytes fee)
|
||||||
|
let snote =
|
||||||
|
OutgoingNote
|
||||||
|
4
|
||||||
|
(getBytes $
|
||||||
|
getOrchSK $ zcashAccountOrchSpendKey $ entityVal acc)
|
||||||
|
(getBytes oRcvr)
|
||||||
|
(fromIntegral $ noteTotal - feeAmt)
|
||||||
""
|
""
|
||||||
True
|
True
|
||||||
let tx =
|
let tx =
|
||||||
|
|
Loading…
Reference in a new issue