Skip to content

Commit

Permalink
Always show privacyGroupId on PrivateTransactionReceipt (#3544)
Browse files Browse the repository at this point in the history
- This is to provide a clearer way of knowing which
privacyGroupId a private transaction ended up in.

Signed-off-by: Antony Denyer <git@antonydenyer.co.uk>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
  • Loading branch information
antonydenyer and macfarla authored Mar 9, 2022
1 parent 1adc58d commit 64ec6c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void aliceCanUsePrivDistributeTransaction() {
"A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=",
new ArrayList<>(
Collections.singletonList("Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=")),
null,
"DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w=",
"0x1",
null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.TransactionReceiptLogResult;
import org.hyperledger.besu.ethereum.privacy.PrivacyGroupUtil;
import org.hyperledger.besu.evm.log.Log;
import org.hyperledger.besu.evm.log.LogsBloomFilter;

Expand Down Expand Up @@ -91,7 +92,10 @@ public PrivateTransactionReceiptResult(
privateFor != null
? privateFor.stream().map(Bytes::toBase64String).collect(Collectors.toList())
: null;
this.privacyGroupId = privacyGroupId != null ? privacyGroupId.toBase64String() : null;
this.privacyGroupId =
privacyGroupId != null
? privacyGroupId.toBase64String()
: PrivacyGroupUtil.calculateEeaPrivacyGroupId(privateFrom, privateFor).toBase64String();
this.revertReason = revertReason != null ? revertReason.toString() : null;
this.status = status;
this.logs = logReceipts(logs, blockNumber, commitmentHash, blockHash, txIndex);
Expand Down

0 comments on commit 64ec6c7

Please sign in to comment.