setGroupWitnesses method
dynamic
setGroupWitnesses()
Implementation
setGroupWitnesses() {
if (witnesses!.length < inputs!.length) {
throw Exception(
'Transaction witnesses count must not be smaller than inputs count');
}
if (scriptGroup!.inputIndexes.isEmpty) {
throw Exception('Need at least one witness!');
}
scriptGroup!.inputIndexes
.forEach((index) => groupWitnesses.add(witnesses![index]));
for (var i = inputs!.length; i < witnesses!.length; i++) {
groupWitnesses.add(witnesses![i]);
}
if (groupWitnesses[0] is! Witness) {
throw Exception('First witness must be of Witness type!');
}
}