isAccountWritable method

bool isAccountWritable(
  1. int index
)

Check if the account at index is a writable account.

Implementation

bool isAccountWritable(final int index) {
  if (index >= accountKeys.length) {
    int lookupWritableOffset = accountKeys.length;
    for (final MessageAddressTableLookup lookup in addressTableLookups) {
      lookupWritableOffset += lookup.writableIndexes.length;
      if (index < lookupWritableOffset) return true;
    }
    return false;
  } else {
    return index < header.numRequiredSignatures - header.numReadonlySignedAccounts
      || (index >= header.numRequiredSignatures
        && index < accountKeys.length - header.numReadonlyUnsignedAccounts);
  }
}