bip62 function
Check BIP62
Reference: https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki
Implementation
bool bip62(Uint8List buffer) {
int i = 0;
while (i < buffer.length) {
var opcode = buffer[i];
// is this a data PUSH?
if (opcode >= 0 && opcode <= OPS['OP_PUSHDATA4']!) {
var d = push_data.decode(buffer, i);
// did reading a pushDataInt fail? empty script
if (d == null) return false;
i += d.size;
// attempt to read too much data? empty script
if (i + d.number > buffer.length) return false;
Uint8List data = buffer.sublist(i, i + d.number);
i += d.number;
if (d.number > _maxScriptElementSize) return false;
if (!_checkMinimalPush(opcode, data)) return false;
// opcode
} else {
++i;
}
}
return true;
}