TransactionConfidence: check for mutation of an already set source

This commit is contained in:
Andreas Schildbach 2023-10-01 18:34:02 +02:00
parent e0b46d7c64
commit d8e864fb24

View File

@ -523,8 +523,12 @@ public class TransactionConfidence {
* from the peer to peer network, or make it ourselves, or receive it via Bluetooth, or import it from another app,
* and so on. This information is useful for {@link CoinSelector} implementations to risk analyze
* transactions and decide when to spend them.
* <p>
* Once set it's immutable.
*/
public synchronized void setSource(Source source) {
checkState(this.source == Source.UNKNOWN || source == this.source, () ->
"source cannot be set again: from " + this.source + " to " + source);
this.source = source;
}