@@ -138,6 +138,65 @@ func TestUtxoValidateWithdrawals_DRepDelegationProtocolGate(t *testing.T) {
138138 ))
139139 })
140140
141+ for _ , major := range []uint {
142+ common .ProtocolVersionPlomin ,
143+ common .ProtocolVersionVanRossem ,
144+ } {
145+ t .Run (fmt .Sprintf ("PV%d zero amount" , major ), func (t * testing.T ) {
146+ zeroTx := * tx
147+ zeroTx .Body .TxWithdrawals = map [* common.Address ]uint64 {
148+ & rewardAddr : 0 ,
149+ }
150+ pp := & conway.ConwayProtocolParameters {
151+ ProtocolVersion : common.ProtocolParametersProtocolVersion {
152+ Major : major ,
153+ },
154+ }
155+ require .NoError (t , conway .UtxoValidateWithdrawals (
156+ & zeroTx ,
157+ 0 ,
158+ struct { common.LedgerState }{LedgerState : baseState },
159+ pp ,
160+ ))
161+ })
162+ }
163+
164+ t .Run ("PV10 mixed amounts checks non-zero withdrawal" , func (t * testing.T ) {
165+ otherStakeKeyHash := common .Blake2b224Hash (
166+ []byte ("other-withdrawal-stake-key" ),
167+ )
168+ otherRewardAddr := makeConwayRewardAddress (t , otherStakeKeyHash )
169+ mixedTx := * tx
170+ mixedTx .Body .TxWithdrawals = map [* common.Address ]uint64 {
171+ & rewardAddr : 0 ,
172+ & otherRewardAddr : 1_000_000 ,
173+ }
174+ mixedState := mockledger .NewLedgerStateBuilder ().
175+ WithRewardAccountBalance (stakeKeyHash , 1_000_000 ).
176+ WithRewardAccountBalance (otherStakeKeyHash , 1_000_000 ).
177+ WithDRepDelegation (func (
178+ credential common.Credential ,
179+ ) (* common.Drep , error ) {
180+ assert .Equal (t , otherStakeKeyHash , credential .Credential )
181+ return nil , nil
182+ }).
183+ Build ()
184+ pp := & conway.ConwayProtocolParameters {
185+ ProtocolVersion : common.ProtocolParametersProtocolVersion {
186+ Major : common .ProtocolVersionPlomin ,
187+ },
188+ }
189+ err := conway .UtxoValidateWithdrawals (
190+ & mixedTx ,
191+ 0 ,
192+ mixedState ,
193+ pp ,
194+ )
195+ var target conway.WithdrawalNotDelegatedToDRepError
196+ require .ErrorAs (t , err , & target )
197+ assert .Equal (t , otherRewardAddr , target .RewardAddress )
198+ })
199+
141200 t .Run ("PV10 requires delegation lookup support" , func (t * testing.T ) {
142201 pp := & conway.ConwayProtocolParameters {
143202 ProtocolVersion : common.ProtocolParametersProtocolVersion {
0 commit comments