Skip to content

Commit 3e9b0b1

Browse files
Robert 'Probie' OffnerJimbo4350
Robert 'Probie' Offner
authored andcommitted
Append change instead of prepending it
It's desirable for a client to be able to predict the index of outputs. As such we append change to the end so that the index of other outputs doesn't changed based on whether there's change or not. Resolves #3725
1 parent e9c5591 commit 3e9b0b1

File tree

2 files changed

+6
-59
lines changed

2 files changed

+6
-59
lines changed

cardano-api/ChangeLog.md

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,10 @@
11
# Changelog for cardano-api
22

3-
## 1.35.3 -- August 2022
3+
## vNext
44

5-
- Fix leadership schedule for current on babbage (#4106)
6-
- Update build to allow all invalid scripts (again) (#4088)
7-
- Fix building of Alonzo transaction in Babbage era. (#4166)
8-
- Add `utxoCostPerByte` protocol parameter (#4141)
5+
### Features
96

10-
## 1.35.2 -- July 2022 (not released)
11-
12-
None
13-
14-
## 1.35.1 -- July 2022 (not released)
15-
16-
None
17-
18-
## 1.35.0 -- June 2022
19-
- Add Vasil hardfork to cardano-api and cardano-cli (#3765)
20-
- Reference script integration (#3953)
21-
- Wire up remaining Plutusv2 reference script types (#4034)
22-
- Add `IsString` (Hash BlockHeader) (#3619)
23-
- Make `LedgerStateEvents` a type alias (#3692)
24-
- Propagate protocol epoch state decode error (#3696)
25-
- Expose the tx mempool monitoring mini protocol in cardano-api (#3706)
26-
- Babbage functionality integration in cardano api Part 1 (#3803)
27-
- Remove unused package (#3816)
28-
- Add `IsCardanoEra` constraint to BlockInMode (#3665)
29-
- Update cardano-api's TxOut with inline datum (#3773)
30-
- Update cardano-api txout with reference scripts (#3779)
31-
- Implement return and total collateral in cardano-api (#3787)
32-
- Add reference transaction inputs to cardano-api (#3804)
33-
- Fix datum in tx and ref scripts (#3882)
34-
- Support the babbage era in the API function `cddlTypeToEra` (#3916)
35-
- Fix typo for TxWitness BabbageEra (#3961)
36-
- kes-period-info property test (#3718)
37-
- Extend deserialiseFromRawBytesHex to produce error description (#3304)
38-
- add genesis create-cardano command (#3832)
39-
- Propagate protocol in block type (#3818)
40-
- Create VRF signing key file with correct permissions (#1948)
41-
- Update example-reference-script-usage.sh to also use inline datums (#4006)
42-
- Restore deleted comment (#4044)
43-
- Do not require decentralization parameter in protocol parameters (#4051)
44-
45-
46-
## 1.34.0 -- February 2022
47-
48-
- Expose `lovelaceToTxOutValue`. (#3381)
49-
- Implement two functions: `currentEpochEligibleLeadershipSlots` and
50-
`nextEpochEligibleLeadershipSlots` to get the leadership slots for the
51-
current/next epoch respectively. (#3464, #3494)
52-
- Various small intenral fixes. (#3466)
53-
- Add a `capi` library to support using the cardano node as a C library in other
54-
software. (#3501)
55-
- `fromShelleyAddr` now takes an explicit `ShelleyBasedEra` parameter to
56-
determine the era. The previous behaviour (with an implicit
57-
`IsShelleyBasedEra` constraint) can be obtained with `fromShelleyAddrIsSbe`.
58-
(#2253, #3606)
59-
60-
### Bugs
61-
62-
- Allow reading text envelopes from pipes ([PR 4384](https://github.com/input-output-hk/cardano-node/pull/4384))
7+
- Append, not prepend change output when balancing a transaction ([PR 4343](https://github.com/input-output-hk/cardano-node/pull/4343))
638

649
## 1.33.0 -- December 2021
6510
## 1.32.1 -- November 2021

cardano-api/src/Cardano/Api/Fees.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,9 @@ makeTransactionBodyAutoBalance eraInMode systemstart history pparams
11291129
accountForNoChange change@(TxOut _ balance _ _) rest =
11301130
case txOutValueToLovelace balance of
11311131
Lovelace 0 -> rest
1132-
_ -> change : rest
1132+
-- We append change at the end so a client can predict the indexes
1133+
-- of the outputs
1134+
_ -> rest ++ [change]
11331135

11341136
balanceCheck :: TxOutValue era -> Either TxBodyErrorAutoBalance ()
11351137
balanceCheck balance

0 commit comments

Comments
 (0)