Preconditions.checkArgument(SigHash.ALL == mode || SigHash.NONE == mode || SigHash.SINGLE == mode);
int sighashFlags = mode.value;
if(anyoneCanPay) {
sighashFlags |= SigHash.ANYONECANPAY.value;
}
return sighashFlags |= SigHash.FORK_ID.value;
}
public static int calcSigHashValue(SigHash mode, boolean anyoneCanPay, boolean forkid) {
Preconditions.checkArgument(SigHash.ALL == mode || SigHash.NONE == mode || SigHash.SINGLE == mode);
int sighashFlags = mode.value;
if(anyoneCanPay) {
sighashFlags |= SigHash.ANYONECANPAY.value;
}
if(forkid) {
sighashFlags |= SigHash.FORK_ID.value;
}
return sighashFlags;
}
and answer is: