mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Script.ScriptType: Use stable id for persistence, rather than ordinal().
This commit is contained in:
parent
c337970ca8
commit
d231bade1f
@ -56,13 +56,18 @@ public class Script {
|
|||||||
|
|
||||||
/** Enumeration to encapsulate the type of this script. */
|
/** Enumeration to encapsulate the type of this script. */
|
||||||
public enum ScriptType {
|
public enum ScriptType {
|
||||||
// Do NOT change the ordering of the following definitions because their ordinals are stored in databases.
|
NO_TYPE(0),
|
||||||
NO_TYPE,
|
P2PKH(1), // pay to pubkey hash (aka pay to address)
|
||||||
P2PKH, // pay to pubkey hash (aka pay to address)
|
P2PK(2), // pay to pubkey
|
||||||
P2PK, // pay to pubkey
|
P2SH(3), // pay to script hash
|
||||||
P2SH, // pay to script hash
|
P2WPKH(4), // pay to witness pubkey hash
|
||||||
P2WPKH, // pay to witness pubkey hash
|
P2WSH(5); // pay to witness script hash
|
||||||
P2WSH, // pay to witness script hash
|
|
||||||
|
public final int id;
|
||||||
|
|
||||||
|
private ScriptType(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Flags to pass to {@link Script#correctlySpends(Transaction, long, Script, Set)}.
|
/** Flags to pass to {@link Script#correctlySpends(Transaction, long, Script, Set)}.
|
||||||
|
@ -959,7 +959,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
|
|||||||
s.setLong(4, out.getValue().value);
|
s.setLong(4, out.getValue().value);
|
||||||
s.setBytes(5, out.getScript().getProgram());
|
s.setBytes(5, out.getScript().getProgram());
|
||||||
s.setString(6, out.getAddress());
|
s.setString(6, out.getAddress());
|
||||||
s.setInt(7, out.getScript().getScriptType().ordinal());
|
s.setInt(7, out.getScript().getScriptType().id);
|
||||||
s.setBoolean(8, out.isCoinbase());
|
s.setBoolean(8, out.isCoinbase());
|
||||||
s.executeUpdate();
|
s.executeUpdate();
|
||||||
s.close();
|
s.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user