SENIORCHAPTER 55

When a bank or a switch goes down

A bank that is down refuses a transfer before the money moves. A switch that is slow leaves it in doubt. Tell the two apart, say pending and not failed, and reconcile every timeout afterwards

85 MINPAYMENTSUPDATED 2026-11-18
PREDICT

During B07's outage a customer of another bank sends money to a B07 account. In the lab's model, which result is the most likely?

A customer sees one thing: the transfer did not work. Behind that screen there are two failures with different consequences, and the runbook starts with telling them apart.

A participant is any institution connected to the switch. The lab has 32: banks, payment service banks, microfinance banks, mobile money operators and Owoleaf. The terms name enquiry, session id and status query (TSQ) are defined in Nigeria’s rails and transfers and virtual accounts. A participant is down when it does not answer at all. The switch is degraded when it answers some requests slowly, or not at all, for many participants at once.

A participant is down The switch is degraded
Who is affected Senders to that bank, and that bank’s own customers sending out Senders at every bank
Spread of the failures One receiving bank Many receiving banks
Where the failure lands Usually the name enquiry, before any debit After the debit, on the answer
Money Not in doubt, except for the few already past the enquiry In doubt until a status query answers
Who can fix it That bank The switch operator
In the lab B07, Wednesday 11:02 to 11:49 Thursday 15:20 to 15:34

Every code, timing and rate in the lab is illustrative: rails.py models NIP-style behaviour and is not NIBSS’s network. Real rules appear below in dated notes that name their source, taken from sources the search results showed.

Where in the sequence the failure lands

1 nameenquiry2 debit thecustomer3 send tothe switch4 the answer00, 91, 975 credit, thensettlea refusal here:nothing debiteda refusal or a timeout here: the customer is debited91 comes back and the bank reverses; 97 leaves the money in doubtuntil a status query answersIf the sending bank is the one that is down, step 1 never starts:the switch sees nothing, and only an absence of traffic shows it.

The diagram is the whole chapter in one picture. Money is exposed between the debit and the answer, and only there.

A refusal at step 1 is the good case. The sender’s bank asks the receiving bank whose account this is, a down bank answers 91 (“beneficiary bank not available” in the lab), and nothing has moved. In the lab’s generated week this is how B07’s outage mostly looks: 11 refused enquiries and no debit.

A refusal at step 3 is the narrow gap. A saved beneficiary skips the enquiry: about a third of the lab’s transfers reuse an earlier one, so the first the receiver hears of the payment is the send. The bank debited, and the answer was 91. The sending bank must put the money back. In the lab it does so 40 seconds later, and four customers were in this position.

A timeout at step 4 is the dangerous one. No answer is not a no. The lab answers 97 after 30 seconds, and the money is in doubt: the receiver may have credited it, may never have seen it, or may credit it a minute later. The only safe moves are to ask and to wait. NIBSS’s help-centre page on NIP services lists a transaction status query that lets a bank check the status of a transaction it sent earlieras of 2026-11. That is the status query the lab calls tsq. The earlier chapters on payment states and idempotency explain why a timeout may be neither resent nor reversed.

How often does a 97 turn out to be a success? In the lab’s week, 42 of the 101 timeouts (42%) had reached the receiver, worth ₦469,067. A bank that treats every timeout as a failure and reverses its customer pays that money out twice, once to its customer and once to the receiver through settlement. You will measure this in step 6.

The week in the data, and why an outage is slow to show

Step 2 reads the outages table and then asks the switch’s own tables what happened inside each window. B07 is a large bank, so its 47 minutes leave marks. It sent 2 transfers between 11:02 and 11:48, against a mean of 11.0 in the same minutes on the other four weekdays, and received 4 against 9.5. Eleven name enquiries to B07 were refused, and four transfers were refused too, from customers who had sent to a saved beneficiary and so skipped the enquiry.

Even so, the evidence arrives late. The first refusal came at 11:07:38, 5.6 minutes in, and a rule that wants two different senders refused fires at 11:09:18, 7.3 minutes in. That is the first lesson, and it is about detection. The evidence of a bank’s outage is customers who happen to ask, and some of it is an absence: the sender’s own customers never reach the switch, so nothing is logged. A success-rate dashboard that has to wait for refusals learns of the outage at the pace of its customers. Step 5 shows the rule, and its break shows the same rule 30 minutes late on another seed. A probe, one name enquiry to every participant each minute, does not depend on customers. It finds the outage within one probe interval, at any volume, and its cost is a trickle of traffic.

The Thursday incident is easier to see. Between 15:20 and 15:33, 20 of 46 transfers answered 97, 43.48%, against 0.45% in the rest of the week. The lab’s model gives each transfer in the window a 40% chance of timing out, so about 18 of 46 would be expected, and 20 is an ordinary draw. Seeds 1 to 8 give 26% to 57% for the same window: a window with 46 transfers is a small sample, and one week is one draw. The twenty reached 13 different banks. That spread is the second lesson: count the distinct receiving banks among the failures. All of B07’s refusals named B07. Twenty timeouts to thirteen banks is not thirteen bank problems; it points at the one thing they share, the switch. A real bank’s traffic is what it is, which is why the runbook cannot rely on customers to be its alarm.

What each party’s customers saw

Write the incident down once from each seat.

B07’s own customers, sending out. They can hardly start a transfer, and the switch logs almost nothing for them. Only the missing traffic shows it: 2 sent in the window against 11.0 on a normal weekday. They are told that transfers to other banks are unavailable and that transfers inside the bank still work. A Business Post report of NIBSS downtime, which is press and not a primary source, reports that NIBSS’s instant payment channel appeared to be down and that interbank transfers were blocked. The search results showed no official statement tied to it.

Other banks’ customers, sending to B07. They see a refusal at the name enquiry and nothing is debited. A customer who sent to a saved beneficiary sees a debit and, 40 seconds later in the lab, the money back. Of the 11 refused enquiries, 7 were followed by the same transfer to the same account later.

Customers at every bank during the switch incident. They are debited, wait 30 seconds and get a timeout. Step 4 lists the twenty. Twelve had reached the receiver, and their banks completed the transfer after 3 to 30 minutes of status queries that answered 00. Seven had not, and their banks put the money back after queries that answered “no record”, 3 to 27 minutes on. The twentieth is B01’s customer, paying ₦18,200 to B07 at 15:32:49. Her bank has no status query for it and reversed her, and B07 had credited the beneficiary. The switch’s final status is 97, so the transfer never settles: B07 is ₦18,200 out of pocket until it recovers it, and the customer has her money back too.

Receiving banks credit or refuse, and may credit after the sender has given up, as B07 did. From its own log a receiver cannot tell that the sender reversed.

Businesses and wallets on top see a payout with no answer, the case in payment states. A TheCable report, which is press, describes fintechs relaying NIBSS’s confirmation of intermittent failures to their customers and warning that transfers would be delayed. They are the audience least in control of the facts.

The second wave

When a bank comes back, the work does not end. Customers who were refused try again, and so do automated senders. B07 returned at 11:49. Of the 11 refused enquiries, 7 were followed by the same transfer to the same account, 28 to 102 minutes after the refusal. Wednesday’s transfers to B07 between 11:50 and 13:19 number 8 more than a normal day, about the same as the 7 identified retries, though ten-minute counts here are single digits and the match is partly luck. In the lab’s model the customers return across the next 90 minutes, so the extra traffic is a hump and not a spike. The model is the customers’ own behaviour. A bank’s own retry queue, or a company’s payout job that has been waiting for the outage to end, has no reason to spread out, and arrives together.

That is why a recovering bank is fragile. The lessons on retry storms and retries with backoff and jitter describe the mechanism: a system that has come back meets all its deferred demand at once, and fails again. Step 7 builds the sender’s half of the answer, a circuit breaker in front of the name enquiry. It stops sending to a bank that keeps refusing, tests it with an occasional probe, and releases its waiting customers gradually when the probe passes. The breaker has costs too: in the lab it noticed the recovery 1.0 second late, and the length of its cool-down is a trade between that delay and the probe load on a bank that is still struggling.

A retry after a timeout is a different and worse case. A customer refused at the enquiry has not been debited, so her second attempt is safe. A new payment sent after a 97 would pay twice in 42% of cases in the lab. A payment reference reused on the resend can let the receiver refuse a duplicate, and the rule is the same as before: requery, do not resend.

The runbook: detect, route, communicate, reconcile

A runbook is the short document an on-call person follows at 11:02, when thinking is expensive. Eloho’s team and Enobong’s team each keep their own, and each answers four questions in order.

Detect

Three signals, in the order they arrive. A probe, a synthetic name enquiry to every participant each minute, finds a down bank within a minute at any volume. A per-bank refusal rule finds it when customers do: in the lab, two different senders refused by the same bank within five minutes. A switch-wide timeout share finds a degraded switch: at least three timeouts to three or more banks in five minutes that are at least 10% of the transfers in those minutes. Step 5 runs the last two on the week. In the lab’s week the bank rule fires at 11:09:18, 7.3 minutes into the outage, and the switch rule at 15:21:07, 1.1 minutes after the Thursday incident starts, with no false alarm.

Do not trust that result. The thresholds were chosen by looking at the answer. The break at the end of the lab runs the same rules on a week generated with another seed: the bank rule fires 30.2 minutes into the 47-minute outage. A rule tuned on one week is a hypothesis about the next, and the lab shows only the lateness, not a false alarm. The model also has no background refusals: in a real network a bank refuses an enquiry for ordinary reasons all day, so a single refusal is not an alarm. The later chapter Running a switch takes alert design further.

Then triage: count the distinct receiving banks among the failures. One bank, the bank’s problem; many, the switch’s. A third reading is local: your own link may be the failing part, so check your side before you tell the world it is the other side.

Route

Routing during an incident is mostly deciding what not to do.

A bank that is down cannot be routed around. The account lives there, and no other path reaches it. What the switch can do is fail fast: once a bank is clearly down, answer enquiries for it at once with the refusal code, so senders find out in a second and not after a timeout, and probe it until it answers again. Whether to do this is the decision at the end of the chapter. Whether a switch may go further, and stand in to credit on behalf of a bank that cannot answer, is a risk decision that belongs to the later chapter Inside a switch.

A sender keeps the breaker from step 7 in front of the enquiry, and never queues a debit it cannot send. A customer who has not been debited can be told to try again. A customer who has been debited and has no answer is in doubt, and the sender follows the status-query schedule. In the lab’s week the 101 timeouts produced 136 status queries, one to three each, and 11 timeouts were never queried at all. A requery loop that is too eager adds load to a switch that is already degraded, which is why the schedule backs off.

The switch’s own recovery is a failover to a second site, and it is the operator’s to run. The sources the search results showed say little about it (see the rules below), so ask three questions instead of quoting a figure: what is the recovery target, who can invoke the failover, and how often is it tested?

Communicate

There are four audiences, each needing a different sentence: customers, support staff, the businesses that send through the bank, and the other side of the link. Four rules for the message. Say pending, never failed, for money in doubt. Say what has happened to the money, in a sentence a call-centre agent can repeat: not debited, debited and being checked, or debited and returned. Say when the next update comes, and keep to it. Never state a cause you do not have.

Step 4 prints a draft note for the Thursday incident from the numbers: how many transfers were left unconfirmed, their value, and the sentence a person approves. A ThisDay article of November 2022 on the payment system is summarised in search results as saying that electronic reversals are expected instantly or within 24 hours, that an unresolved dispute is logged with the bank and should be treated within 72 hours, and that NIBSS hosts an Industry Dispute Resolution Systemas of 2026-11. It is press, it is old, and CBN directives of 2020 changed some timelines for card channels. Figures differ between sources, as the earlier chapter showed, so the note quotes none.

Reconcile

This is the slowest part, and the one that decides who loses money. The rule is to reconcile every transfer that was in doubt, across the whole week, not those inside the incident window. Step 6 builds three views of every transfer: the switch’s final status, the sender’s log and the receiver’s log. A transfer is clean when they agree. It finds three kinds of disagreement:

  • Reversed after a late success. The switch’s final status is 00, and the sender reversed its customer. The sender is out of pocket, because the transfer settles.
  • Credited without settlement. The receiver credited the beneficiary, but the transfer’s final status is not 00, so it never settles. The receiver is out of pocket.
  • A customer reversed twice. The sender put the money back two times.

The lab finds eleven, and one lies inside the Thursday window. B01’s ₦18,200 to B07 is the incident’s: credited, never settled, never queried. B19’s ₦6,336 credited without settlement is a Tuesday-morning timeout, one of ten breaks on ordinary days. Timeouts happen then too (0.45% of transfers outside the window), so the reconciliation is a daily job, not an incident job. The chapter on reconciliation and the module’s chapter on debited but not credited take the money side: who recovers what, and from whom.

The reconciliation also settles the question of the late success. A late success settles in a settlement session by the time of its final status. B11’s ₦16,295 transfer on Wednesday, reversed by its sender but answered 00 at 15:59:52, settled in session 20260617-4, in the lab’s model, with a cut-off at 18:00 and settlement an hour later. The later chapter How banks settle with each other explains sessions.

What the rules say, and what this chapter could not find

The CBN’s 2018 Regulation on Instant (Inter-Bank) Electronic Funds Transfer Services in Nigeria (effective 2 October 2018 according to most sources; one entry gives 20 October) is summarised in press and law-firm results as requiring name enquiry support and receiving banks to credit the beneficiary within 60 seconds or notify the parties if pending. The summaries differ on failed transfers: one cites a 10-minute refund of a failed transaction returned by the receiving entity, and a refund of one it was unable to process within one hour after the next settlement closure, while press reports cite a ₦10,000 fine per item not reversed within 24 hours of a complaint, and the summaries do not reconcile the two clocks. They also say a wrongly credited transfer is reversed within one business day where funds are available, and that settlement is as agreed but no later than T+1, the next business dayas of 2026-11. This build could not open the PDF, so read its failed-transaction sections and treat any deadline here as unconfirmed.

On resilience the search results showed three documents and one gap. NIBSS’s published business continuity policy statement says it is committed to a business continuity management system (BCMS) aligned to the ISO 22301:2019 standard, and to implementing recovery strategies for time-critical activities. It says aligned to, and the search results showed no certificateas of 2026-11. The CPMI and IOSCO Principles for Financial Market Infrastructures (PFMI, 2012), Principle 17 on operational risk, are summarised in search results as expecting a payment system’s continuity plan to use a secondary site and to let critical systems resume within two hours of a disruptionas of 2026-11. That is an international benchmark, and this chapter did not confirm whether or how the CBN applies it to NIBSS. The CBN’s 2023 Operational Guidelines for Open Banking in Nigeria are summarised as requiring participants to keep business continuity and disaster recovery plans; one law-firm summary says they are tested every six months, which this chapter did not confirm in the textas of 2026-11. They cover open banking, not NIP, and this chapter takes no availability figure from them.

The gap matters more. The search results showed no CBN document setting an availability target for NIP or for deposit money banks, no deadline for telling the regulator or customers about an outage, and no NIBSS recovery-time or uptime statistic for NIP. They may sit in your licence conditions, your sponsor bank’s agreement or NIBSS’s participant rules, none of which the results showed. Ask for them before you write the runbook’s timings, and date the answer.

One public example shows how far reconciliation can run. Press reports say a software error in NIP’s engine in September 2024 (dated 6 September in court filings, 6 to 9 September by ThisDay) wrongly moved about ₦13.66 billion, and that NIBSS went to the Federal High Court in Lagos to recover it. A BusinessDay report says the error still haunts NIBSS nearly two years later. The sources differ on the number of accounts and the sum recoverable, and this chapter read no court filing. It is a different fault from the lab’s B19 credit, but it shows how large an unreconciled error can grow.

Where this goes wrong

Name the failures first. Each looks reasonable at 11:02.

Treating 97 as a failure. The bank reverses the customer, and 42% of the time the receiver had credited. Wait for a status query that says no record.

Retrying after a timeout. The same mistake from the customer’s side. Requery, and resend only with the same payment reference.

Counting the outage in minutes. B07 was down for 47 minutes, but the cost arrives later: the retries, the in-doubt money, the reconciliation.

Waiting for customers to be the alarm, or tuning an alert on the last incident. The first refusal came 5.6 minutes in, and on another seed a two-sender rule fired 30.2 minutes in. A rule fitted to one week is a hypothesis about the next.

Naming the switch when it is a bank. Count the distinct receiving banks before you send every support team to the wrong door.

Scoping the reconciliation to the window. Ten of the eleven breaks in the lab fall on ordinary days.

A status page that says all is well. If your own link is the part that is down, you will not see your absence. Check from outside.

LAB Find a bank's outage and a switch incident in the week, detect them, reconcile them and protect a sender ~75 MIN
YOU NEEDPython 3.9 or later (standard library only)labs/finance with data generated (python3 generate.py), for the mock in step 7Two terminals for step 7No Docker, no packages

You work in labs/finance. The analysis steps are Python’s own sqlite3 module on data/rails.sqlite; the sqlite3 command-line tool is not needed. The scripts go in a work/ folder that is yours. Every response code, threshold, cut-off and timing here is the lab’s, not NIBSS’s or any bank’s. Your numbers match the ones quoted because the seed is fixed. Times are West Africa Time, as in the data.

1. Generate the week and check it. About a second.

cd labs/finance
python3 rails.py
python3 check.py --rails-only
mkdir -p work

rails.py prints:

32 participants, 22,835 accounts, 17,998 transfers, 12,158 name enquiries, 136 status queries
21 settlement sessions, 125 batch files, 193 RTGS payments, 3,412 USSD sessions, 3,453 PSB postings
planted (answers/rails_truth.csv): credited_without_settlement 4, customer_fee_not_charged 6, customer_reversed_twice 3, levy_not_charged 5, mmo_trust_shortfall 1, participant_limit 4, participant_outage 1, psb_cash_out_fee_not_posted 1, psb_cash_out_posted_twice 1, reversed_after_late_success 4, same_number_two_banks 8, switch_incident 1, telco_record_missing 12

and check.py prints:

rails week: 17,998 transfers, 21 settlement sessions, 22,835 accounts; checks 21-25 run
OK: all invariants hold

The week runs Monday 15 to Sunday 21 June 2026. Invariants 21 to 25 hold, so the settlement sessions net to zero and every status change has a status query behind it. Both incidents are in the data on purpose, and the outages table says when.

2. Find both incidents in the switch’s own tables. Save this as work/incidents.py and run it. It reads the outages table, then compares each window with the same clock minutes on other days (B07) or the rest of the week (the switch).

cat > work/incidents.py <<'PY'
import sqlite3, sys

db = sqlite3.connect(sys.argv[1] if len(sys.argv) > 1 else "data/rails.sqlite")
q = lambda sql, *a: db.execute(sql, a).fetchall()

print("1. the outages table")
for who, start, end, what in q("SELECT who, start_at, end_at, what FROM outages"):
    print(f"   {who:<7} {start[:16]} to {end[11:16]}  {what}")

# B07, Wednesday 11:02-11:49. Compare the same clock window on the four other weekdays.
WIN = ("11:02", "11:48")
def in_window(col):
    return f"substr({col}, 12, 5) BETWEEN '{WIN[0]}' AND '{WIN[1]}'"
WED = "substr(at, 1, 10) = '2026-06-17'"
OTHER = "substr(at, 1, 10) IN ('2026-06-15', '2026-06-16', '2026-06-18', '2026-06-19')"

print("2. B07 in its window (11:02 to 11:48), Wednesday against the mean of four other weekdays")
for label, col in (("transfers sent by B07", "src"), ("transfers sent to B07", "dest")):
    wed, = q(f"SELECT COUNT(*) FROM transfers WHERE {col} = 'B07' AND {WED} AND {in_window('at')}")[0]
    oth, = q(f"SELECT COUNT(*) FROM transfers WHERE {col} = 'B07' AND {OTHER} AND {in_window('at')}")[0]
    print(f"   {label:<24} Wednesday {wed:>3}   other days {oth / 4:>5.1f}")
for resp, n in q(f"SELECT response, COUNT(*) FROM name_enquiries WHERE dest = 'B07' AND {WED} AND {in_window('at')} GROUP BY 1"):
    print(f"   name enquiries to B07 answered {resp}: {n}")
n91, = q("SELECT COUNT(*) FROM name_enquiries WHERE response = '91'")[0]
print(f"   name enquiries answered 91 in the whole week: {n91}")

print("3. the switch, Thursday 15:20 to 15:33 against every other minute of the week")
a, = q("SELECT COUNT(*) FROM transfers WHERE at >= '2026-06-18T15:20' AND at < '2026-06-18T15:34'")[0]
t, = q("SELECT COUNT(*) FROM transfers WHERE first_response = '97' AND at >= '2026-06-18T15:20' AND at < '2026-06-18T15:34'")[0]
ra, = q("SELECT COUNT(*) FROM transfers WHERE NOT (at >= '2026-06-18T15:20' AND at < '2026-06-18T15:34')")[0]
rt, = q("SELECT COUNT(*) FROM transfers WHERE first_response = '97' AND NOT (at >= '2026-06-18T15:20' AND at < '2026-06-18T15:34')")[0]
print(f"   in the window:  {a:>6,} transfers, {t:>3} timeouts (97), {100 * t / a:5.2f}%")
print(f"   all other time: {ra:>6,} transfers, {rt:>3} timeouts (97), {100 * rt / ra:5.2f}%")
banks, = q("SELECT COUNT(DISTINCT dest) FROM transfers WHERE first_response = '97' AND at >= '2026-06-18T15:20' AND at < '2026-06-18T15:34'")[0]
print(f"   the {t} timeouts went to {banks} different receiving banks")
PY
python3 work/incidents.py
1. the outages table
   B07     2026-06-17T11:02 to 11:49  participant unavailable
   switch  2026-06-18T15:20 to 15:34  degraded: timeouts across participants
2. B07 in its window (11:02 to 11:48), Wednesday against the mean of four other weekdays
   transfers sent by B07    Wednesday   2   other days  11.0
   transfers sent to B07    Wednesday   4   other days   9.5
   name enquiries to B07 answered 07: 1
   name enquiries to B07 answered 91: 11
   name enquiries answered 91 in the whole week: 11
3. the switch, Thursday 15:20 to 15:33 against every other minute of the week
   in the window:      46 transfers,  20 timeouts (97), 43.48%
   all other time: 17,952 transfers,  81 timeouts (97),  0.45%
   the 20 timeouts went to 13 different receiving banks

B07’s 47 minutes show as a dip. It sent 2 transfers in the window, both within the first two minutes, against a mean of 11.0 on other days, and received 4 against 9.5. Eleven enquiries were refused (91), and one more was answered 07, a mistyped number, which the lab answers before it asks B07’s link. Four more refusals are on transfers, not enquiries: step 3 finds them. The switch incident stands out at once: 43.48% of transfers timed out against 0.45% in the rest of the week, to 13 different banks. The model says 40% for the window and this seed drew 20 of 46.

3. Watch the second wave. B07 came back at 11:49. Save and run work/b07.py. It asks which refused customers came back, how the traffic to B07 looks in ten-minute bins, and who was debited and then refused at the transfer.

cat > work/b07.py <<'PY'
import datetime as dt, sqlite3, sys

db = sqlite3.connect(sys.argv[1] if len(sys.argv) > 1 else "data/rails.sqlite")
q = lambda sql, *a: db.execute(sql, a).fetchall()
T = dt.datetime.fromisoformat
WED = dt.date(2026, 6, 17)
naira = lambda kobo: f"₦{kobo // 100:,}"

print("1. customers refused at the name enquiry who came back")
refused = q("SELECT at, src, account_no FROM name_enquiries WHERE dest = 'B07' AND response = '91'")
gaps = []
for at, src, acct in refused:
    back = q("""SELECT at FROM transfers WHERE src = ? AND credit_account = ? AND at > '2026-06-17T11:49' AND at < '2026-06-17T13:30'
                ORDER BY at LIMIT 1""", src, acct)
    if back:
        gaps.append(int((T(back[0][0]) - T(at)).total_seconds() // 60))
gaps.sort()
print(f"   {len(refused)} refused; {len(gaps)} sent the same transfer to the same account within 90 minutes of the bank coming back")
print(f"   minutes from the refusal to the retry: first {gaps[0]}, median {gaps[len(gaps) // 2]}, last {gaps[-1]}")

print("2. transfers to B07 in ten-minute bins, Wednesday against the mean of the other four weekdays")
def bins(days):
    out = {}
    for (at,) in q("SELECT at FROM transfers WHERE dest = 'B07'"):
        d = T(at)
        if d.date() in days:
            k = (d.date(), d.hour * 6 + d.minute // 10)
            out[k] = out.get(k, 0) + 1
    return out
others = [dt.date(2026, 6, d) for d in (15, 16, 18, 19)]
c = bins([WED] + others)
print("   from   Wednesday   other days")
extra = 0.0
for b in range(66, 80):                                   # 11:00 to 13:10
    mean = sum(c.get((d, b), 0) for d in others) / 4
    mark = {66: "   <- B07 down from 11:02", 67: "   <- down", 68: "   <- down", 69: "   <- down", 70: "   <- back at 11:49"}.get(b, "")
    print(f"   {b // 6}:{(b % 6) * 10:02d}   {c.get((WED, b), 0):>8}   {mean:>9.1f}{mark}")
    if b >= 71:
        extra += c.get((WED, b), 0) - mean
print(f"   11:50 to 13:19: {extra:.0f} more transfers than a normal day")

print("3. customers who sent to a saved beneficiary, so skipped the name enquiry and met the outage at the transfer")
for sid, at, src, amount in q("SELECT session_id, at, src, amount_kobo FROM transfers WHERE dest = 'B07' AND first_response = '91' AND name_enquiry_id = '' ORDER BY at"):
    posted, reversed_at = q("SELECT posted_at, reversed_at FROM bank_log WHERE session_id = ? AND direction = 'out'", sid)[0]
    wait = int((T(reversed_at) - T(posted)).total_seconds())
    print(f"   {at[11:19]}  {src}  {naira(amount):>10}  debited, then reversed {wait} s later")
PY
python3 work/b07.py
1. customers refused at the name enquiry who came back
   11 refused; 7 sent the same transfer to the same account within 90 minutes of the bank coming back
   minutes from the refusal to the retry: first 28, median 74, last 102
2. transfers to B07 in ten-minute bins, Wednesday against the mean of the other four weekdays
   from   Wednesday   other days
   11:00          0         2.8   <- B07 down from 11:02
   11:10          0         1.5   <- down
   11:20          1         2.5   <- down
   11:30          3         1.5   <- down
   11:40          1         1.8   <- back at 11:49
   11:50          1         1.8
   12:00          3         1.2
   12:10          1         2.0
   12:20          6         2.8
   12:30          3         2.0
   12:40          7         1.8
   12:50          1         2.8
   13:00          3         3.2
   13:10          2         1.0
   11:50 to 13:19: 8 more transfers than a normal day
3. customers who sent to a saved beneficiary, so skipped the name enquiry and met the outage at the transfer
   11:29:37  B03      ₦3,308  debited, then reversed 40 s later
   11:34:21  B17     ₦83,579  debited, then reversed 40 s later
   11:37:03  B12     ₦11,282  debited, then reversed 40 s later
   11:39:05  B10        ₦826  debited, then reversed 40 s later

The bank’s outage shows as a dip in the bins: 5 transfers to B07 from 11:00 to 11:49 against a mean of about 10, and four of the five are the refused ones. Those four transfers in the last section are customers who sent to a saved beneficiary, so no name enquiry stood in front of the debit: debited, refused with 91, and reversed 40 seconds later. The 8 extra transfers in the hump are close to the 7 retries the script identified by matching the sender and the beneficiary account, but ten-minute counts are single digits and the match is partly luck. Retries came 28 to 102 minutes after the refusal, median 74: customers return over hours, so the second wave is a hump, not a spike. A retry queue inside a bank or a company does not spread out like this.

4. Read what the twenty customers saw. Save this as work/switch_window.py. For every transfer that timed out in the Thursday window it prints the wait, the status queries, the sender’s log and whether the receiver credited. It ends with a draft note a person would approve.

cat > work/switch_window.py <<'PY'
import sqlite3, sys

db = sqlite3.connect(sys.argv[1] if len(sys.argv) > 1 else "data/rails.sqlite")
naira = lambda kobo: f"₦{kobo // 100:,}"
rows = db.execute("""
    SELECT t.session_id, substr(t.at, 12, 8), t.src, t.dest, t.amount_kobo, t.latency_ms, t.final_status,
           substr(t.final_at, 12, 8), t.settlement_session,
           (SELECT group_concat(substr(x.at, 12, 8) || '=' || x.response, ' ') FROM tsq x WHERE x.session_id = t.session_id),
           (SELECT b.status FROM bank_log b WHERE b.session_id = t.session_id AND b.direction = 'out' ORDER BY b.posted_at LIMIT 1),
           (SELECT COUNT(*) FROM bank_log b WHERE b.session_id = t.session_id AND b.direction = 'in')
    FROM transfers t
    WHERE t.first_response = '97' AND t.at >= '2026-06-18T15:20' AND t.at < '2026-06-18T15:34' ORDER BY t.at""").fetchall()
print(f"{len(rows)} transfers answered 97 inside the incident window")
print("  sent      from  to    amount     waited  status queries (time=answer)         final  sender's log  receiver credited")
for sid, at, src, dest, amount, lat, final, fat, sess, tsq, sender, credited in rows:
    waited = (int(fat[:2]) * 3600 + int(fat[3:5]) * 60 + int(fat[6:])) - (int(at[:2]) * 3600 + int(at[3:5]) * 60 + int(at[6:]))
    print(f"  {at}  {src:<5} {dest:<5} {naira(amount):>10} {waited // 60:>3} min  {tsq or 'none':<36} {final:>5}  {sender:<12}  {'yes' if credited else 'no'}")
arrived = sum(1 for r in rows if r[6] == "00")
returned = sum(1 for r in rows if r[10] == "reversed" and not r[11])
print(f"{arrived} reached the receiver and settled; {returned} were returned after a status query said no record")
for r in rows:
    if r[10] == "reversed" and r[11]:
        end = f"settled in session {r[8]}" if r[8] else "so it never settles"
        print(f"  {r[2]} reversed its customer, yet {r[3]} credited {naira(r[4])} and the switch's final status is {r[6]}: {end}")

total = sum(r[4] for r in rows)
print("draft note for customers and support (a person approves it before it goes out):")
print(f"  Between {rows[0][1][:5]} and 15:34 some transfers to other banks received no answer from the network.")
print(f"  {len(rows)} transfers worth {naira(total)} were affected. Each is being checked with the receiving bank.")
print("  Money returns to the sender's account only when that check shows the transfer was not received.")
print("  Please do not send the money again. We will update this note within 30 minutes.")
PY
python3 work/switch_window.py
20 transfers answered 97 inside the incident window
  sent      from  to    amount     waited  status queries (time=answer)         final  sender's log  receiver credited
  15:20:08  B12   B15      ₦13,116  12 min  15:31:08=00 15:31:41=00 15:32:13=00     00  completed     yes
  15:20:55  B01   B24       ₦1,812  17 min  15:37:55=00                             00  completed     yes
  15:21:07  B21   S02       ₦8,863  18 min  15:39:07=00 15:39:25=00                 00  completed     yes
  15:21:54  F03   B03      ₦16,567   6 min  15:27:54=25 15:28:21=25                 97  reversed      no
  15:25:18  B12   B03       ₦5,419   4 min  15:29:18=00 15:29:51=00                 00  completed     yes
  15:25:36  B05   B01      ₦44,224  27 min  15:52:36=25                             97  reversed      no
  15:25:48  B13   B21      ₦11,269  12 min  15:37:48=25                             97  reversed      no
  15:26:05  B15   B22      ₦20,950  30 min  15:56:05=00 15:56:18=00                 00  completed     yes
  15:26:12  B02   B01       ₦4,786   7 min  15:33:12=25                             97  reversed      no
  15:26:37  B21   B22       ₦5,316   3 min  15:29:37=25 15:30:32=25                 97  reversed      no
  15:27:21  B09   B07       ₦6,376  16 min  15:43:21=00 15:44:04=00                 00  completed     yes
  15:28:11  B20   B10       ₦6,688  22 min  15:50:11=25                             97  reversed      no
  15:28:15  B01   B03      ₦17,324  29 min  15:57:15=00                             00  completed     yes
  15:28:53  B03   B10      ₦24,145  21 min  15:49:53=00 15:50:47=00                 00  completed     yes
  15:29:23  B16   B06       ₦3,541   6 min  15:35:23=00                             00  completed     yes
  15:30:12  B05   B17      ₦13,324   3 min  15:33:12=00 15:34:05=00                 00  completed     yes
  15:31:42  B01   B02         ₦929  21 min  15:52:42=00                             00  completed     yes
  15:32:49  B01   B07      ₦18,200   0 min  none                                    97  reversed      yes
  15:33:48  B16   B09       ₦1,691  12 min  15:45:48=25 15:46:24=25                 97  reversed      no
  15:33:53  B17   B02      ₦21,309  22 min  15:55:53=00 15:56:15=00                 00  completed     yes
12 reached the receiver and settled; 7 were returned after a status query said no record
  B01 reversed its customer, yet B07 credited ₦18,200 and the switch's final status is 97: so it never settles
draft note for customers and support (a person approves it before it goes out):
  Between 15:20 and 15:34 some transfers to other banks received no answer from the network.
  20 transfers worth ₦245,849 were affected. Each is being checked with the receiving bank.
  Money returns to the sender's account only when that check shows the transfer was not received.
  Please do not send the money again. We will update this note within 30 minutes.

Twelve transfers had reached the receiver and settled, and their senders completed them after 3 to 30 minutes of status queries. Seven were returned after “no record”, as they should be. The third group is the break: B01 reversed its customer at 15:32:49, B07 had credited the beneficiary, and the final status stays 97 because no status query was ever asked, so the transfer never settles. The draft note says nothing about a cause and nothing about when money returns, but its sentence “each is being checked” is false for that one transfer. Amounts in naira drop the kobo (₦929 is 92,900 kobo).

5. Write the detector, and see how slowly customers raise it. Save this as work/detect.py. Rule A fires when two different senders are refused by the same bank within five minutes. Rule B fires when at least three timeouts to three or more banks in five minutes are at least 10% of the transfers in those minutes. The thresholds are the lab’s. The script also shows rule A with a single sender.

cat > work/detect.py <<'PY'
import bisect, datetime as dt, sqlite3, sys

db = sqlite3.connect(sys.argv[1] if len(sys.argv) > 1 else "data/rails.sqlite")
T = lambda s: dt.datetime.fromisoformat(s)

# What a rule can see: refusals (91), timeouts (97), and the count of all transfers, with times.
refusals = sorted((T(at), src, dest) for at, src, dest in db.execute(
    "SELECT at, src, dest FROM name_enquiries WHERE response = '91' "
    "UNION ALL SELECT at, src, dest FROM transfers WHERE first_response = '91'"))
timeouts = sorted((T(at), dest) for at, dest in db.execute("SELECT at, dest FROM transfers WHERE first_response = '97'"))
every = sorted(T(at) for (at,) in db.execute("SELECT at FROM transfers"))

MIN = dt.timedelta(minutes=5)

# Rule A (illustrative numbers): a bank is down when it refuses N different senders within 5 minutes.
def rule_a(n):
    out, last = [], {}
    for i, (t, src, dest) in enumerate(refusals):
        senders = {s for (u, s, d) in refusals[: i + 1] if d == dest and t - u <= MIN}
        if len(senders) >= n and (dest not in last or t - last[dest] > dt.timedelta(hours=1)):
            last[dest] = t
            out.append((t, dest))
    return out

# Rule B: the switch is degraded when, in 5 minutes, at least 3 timeouts reached 3 or more different
# banks and they are at least 10% of all transfers in those minutes. A share, so it works at any volume.
def rule_b():
    out, last = [], None
    for i, (t, dest) in enumerate(timeouts):
        recent = [(u, d) for (u, d) in timeouts[: i + 1] if t - u <= MIN]
        total = bisect.bisect_right(every, t) - bisect.bisect_left(every, t - MIN)
        if len(recent) >= 3 and len({d for _, d in recent}) >= 3 and len(recent) / total >= 0.10:
            if last is None or t - last > dt.timedelta(hours=1):
                last = t
                out.append((t, "switch"))
    return out

START = {"B07": T("2026-06-17T11:02:00+01:00"), "switch": T("2026-06-18T15:20:00+01:00")}
def show(name, alerts):
    print(f"{name}: {len(alerts)} alert(s)")
    for t, subject in alerts:
        real = subject in START and dt.timedelta(0) <= t - START[subject] < dt.timedelta(minutes=47)
        verdict = f"real, {(t - START[subject]).total_seconds() / 60:.1f} minutes after the start" if real else "no incident: a false alarm"
        print(f"   {t:%a %H:%M:%S}  {subject:<7} {verdict}")
print(f"refusals (91): {len(refusals)}; timeouts (97): {len(timeouts)}; transfers: {len(every):,}")
show("rule A, 2 senders refused within 5 minutes", rule_a(2))
show("rule A with 1 sender (any single refusal)", rule_a(1))
show("rule B, switch degraded", rule_b())
PY
python3 work/detect.py
refusals (91): 15; timeouts (97): 101; transfers: 17,998
rule A, 2 senders refused within 5 minutes: 1 alert(s)
   Wed 11:09:18  B07     real, 7.3 minutes after the start
rule A with 1 sender (any single refusal): 1 alert(s)
   Wed 11:07:38  B07     real, 5.6 minutes after the start
rule B, switch degraded: 1 alert(s)
   Thu 15:21:07  switch  real, 1.1 minutes after the start

Rule A, the two-sender rule, fires at 11:09:18, 7.3 minutes into a 47-minute outage, because refusals come from customers at their own pace. Even a single-refusal rule needs until 11:07:38, 5.6 minutes in. Rule B fires 1.1 minutes after the switch incident starts, because it counts a share and not a number. A probe does not appear in this output, because it needs no customers: one name enquiry a minute to every participant would be refused within a minute of 11:02, at any volume.

6. Reconcile every transfer in doubt, across the whole week. Save this as work/reconcile.py. For each transfer it compares three views: the switch’s final status, the sender’s log and the receiver’s log. The script’s second section opens the answer key, which this step tells you to do, and scores what you found. Its third section shows what a reverse-on-timeout rule would have cost.

cat > work/reconcile.py <<'PY'
import csv, sqlite3, sys

db = sqlite3.connect(sys.argv[1] if len(sys.argv) > 1 else "data/rails.sqlite")
truth_path = (sys.argv[2] if len(sys.argv) > 2 else "data/answers/rails_truth.csv")
naira = lambda kobo: f"₦{kobo // 100:,}"
WINDOW = ("2026-06-18T15:20", "2026-06-18T15:34")

# Three views of every transfer: the switch's final status, the sender's own log, the receiver's own log.
reversals, credits = {}, {}
for sid, direction, status in db.execute("SELECT session_id, direction, status FROM bank_log"):
    if direction == "out" and status == "reversed":
        reversals[sid] = reversals.get(sid, 0) + 1
    if direction == "in":
        credits[sid] = credits.get(sid, 0) + 1
views = [row + (reversals.get(row[0], 0), credits.get(row[0], 0)) for row in db.execute(
    "SELECT session_id, at, src, dest, amount_kobo, first_response, final_status, settlement_session FROM transfers")]

found = {"reversed_after_late_success": [], "credited_without_settlement": [], "customer_reversed_twice": []}
for sid, at, src, dest, amount, first, final, session, reversals, credited in views:
    if final == "00" and reversals >= 1:
        found["reversed_after_late_success"].append((sid, at, src, amount))
    if final != "00" and credited:
        found["credited_without_settlement"].append((sid, at, dest, amount))
    if reversals >= 2:
        found["customer_reversed_twice"].append((sid, at, src, amount))

print("1. the three views disagree on:")
for kind, rows in found.items():
    print(f"   {kind}: {len(rows)}")
    for sid, at, who, amount in rows:
        where = "inside the Thursday incident window" if WINDOW[0] <= at[:16] < WINDOW[1] else "outside the incident window"
        print(f"      {at[5:16].replace('T', ' ')}  {who:<4} {naira(amount):>10}  {where}")

print("2. scored against answers/rails_truth.csv")
with open(truth_path) as f:
    key = [r for r in csv.DictReader(f)]
for kind, rows in found.items():
    want = {r["ref"] for r in key if r["kind"] == kind}
    got = {r[0] for r in rows}
    print(f"   {kind}: found {len(got & want)} of {len(want)}, {len(got - want)} not in the key")

print("3. what a rule 'reverse the customer on a timeout' would have done")
to = [v for v in views if v[5] == "97"]
credited = [v for v in to if v[6] == "00" or v[9]]
print(f"   {len(to)} transfers answered 97 in the week; {len(credited)} of them ({100 * len(credited) / len(to):.0f}%) had reached the receiver")
print(f"   reversing all {len(to)} on the timeout would have returned {naira(sum(v[4] for v in credited))} to customers whose money was credited at the receiver")
PY
python3 work/reconcile.py
1. the three views disagree on:
   reversed_after_late_success: 4
      06-17 15:29  B11     ₦16,295  outside the incident window
      06-18 06:10  S02     ₦13,822  outside the incident window
      06-19 11:38  B22      ₦4,013  outside the incident window
      06-19 12:42  B17      ₦9,517  outside the incident window
   credited_without_settlement: 4
      06-16 07:46  B19      ₦6,336  outside the incident window
      06-18 15:32  B07     ₦18,200  inside the Thursday incident window
      06-19 12:15  B07      ₦1,814  outside the incident window
      06-19 19:02  B23      ₦3,024  outside the incident window
   customer_reversed_twice: 3
      06-17 08:58  B10      ₦6,794  outside the incident window
      06-18 07:46  B21     ₦41,899  outside the incident window
      06-21 19:33  S02      ₦1,810  outside the incident window
2. scored against answers/rails_truth.csv
   reversed_after_late_success: found 4 of 4, 0 not in the key
   credited_without_settlement: found 4 of 4, 0 not in the key
   customer_reversed_twice: found 3 of 3, 0 not in the key
3. what a rule 'reverse the customer on a timeout' would have done
   101 transfers answered 97 in the week; 42 of them (42%) had reached the receiver
   reversing all 101 on the timeout would have returned ₦469,067 to customers whose money was credited at the receiver

Three kinds of disagreement, eleven transfers, all found with nothing missing from the key and nothing extra. Only one, B01’s ₦18,200 to B07, is inside the Thursday window; the rest happened on ordinary days. The third section is the cost of a simple rule. 42 of the 101 timeouts had reached the receiver, 42%, so reversing on the timeout would have returned ₦469,067 to customers whose money was already credited somewhere else. Check the arithmetic: 46,906,700 kobo is ₦469,067.

7. Route: protect a sender with a circuit breaker. In a second terminal start the mock switch (it needs data/finance.sqlite):

cd labs/finance
python3 mock_switch.py --fresh

In the first terminal save and run work/breaker.py. It marks B07 down through the mock’s admin endpoint, sends one name enquiry a tick from a sender with a breaker in front, brings B07 back at tick 12, then shows what happens to the customers who were told to try again later. A tick is half a second on a logical clock, so the output is the same on every run. The mock’s own flag for this fault is --down-banks B07; the script sets and clears it for you.

cat > work/breaker.py <<'PY'
import json, random, urllib.request, urllib.error

BASE = "http://127.0.0.1:8102"
HDR = {"Authorization": "Bearer sw_test_owoleaf_mock", "Content-Type": "application/json"}

def call(method, path, body=None):
    data = json.dumps(body).encode() if body is not None else None
    req = urllib.request.Request(BASE + path, data=data, headers=HDR, method=method)
    try:
        with urllib.request.urlopen(req, timeout=10) as r:
            return json.load(r)
    except urllib.error.HTTPError as e:
        return json.load(e)

class Breaker:
    """Per receiving bank. closed: send. open: fail fast, send nothing. half-open: let one probe through."""
    def __init__(self, threshold=3, cooldown=6):
        self.threshold, self.cooldown = threshold, cooldown
        self.state, self.refusals, self.opened_at = "closed", 0, None
    def allow(self, tick):
        if self.state == "open" and tick - self.opened_at >= self.cooldown:
            self.state = "half-open"
        return self.state != "open"
    def record(self, ok, tick):
        if ok:
            self.state, self.refusals = "closed", 0
        else:
            self.refusals += 1
            if self.state == "half-open" or self.refusals >= self.threshold:
                self.state, self.opened_at = "open", tick

# One attempt to the same bank on every tick. A tick is half a second on a logical clock, so the
# output is the same on every run. B07 comes back at tick 12.
BACK = 12
call("POST", "/admin/faults", {"down_banks": "B07"})
b, calls, failed, closed_at = Breaker(), [], [], None
for tick in range(20):
    if tick == BACK:
        call("POST", "/admin/faults", {"down_banks": ""})
        print(f"t={tick / 2:4.1f}s  -- B07 is back --")
    if not b.allow(tick):
        failed.append(tick)
        print(f"t={tick / 2:4.1f}s  breaker open: failed fast, nothing sent to the switch")
        continue
    mode = b.state
    r = call("POST", "/name-enquiry", {"bank_code": "B07", "account_number": "1234567891"})
    ok = r["response_code"] == "00"
    calls.append(tick)
    if not ok:
        failed.append(tick)
    b.record(ok, tick)
    if ok and closed_at is None:
        closed_at = tick
    print(f"t={tick / 2:4.1f}s  {mode:<9} name enquiry -> {r['response_code']}  breaker now {b.state}")
print(f"20 attempts: {len(calls)} reached the switch, {20 - len(calls)} failed fast; {len(failed)} customers are waiting to retry")
print(f"B07 was back at t={BACK / 2:.1f}s and the breaker noticed at t={closed_at / 2:.1f}s: {(closed_at - BACK) / 2:.1f}s of refusals after recovery")

# Recovery. The waiting customers retry. Without jitter they all arrive on the tick the breaker closes.
def peak(offsets):
    per = {}
    for o in offsets:
        per[o] = per.get(o, 0) + 1
    return max(per.values()), len(per)
rng = random.Random(7)
n = len(failed)
print(f"{n} retries released at once: {peak([0] * n)[0]} requests in one tick")
j = [rng.randrange(10) for _ in range(n)]
print(f"{n} retries spread over 10 ticks: at most {peak(j)[0]} requests in a tick, over {peak(j)[1]} ticks")
PY
python3 work/breaker.py

The mock prints its banner: mock_switch on http://127.0.0.1:8102 institution P01 key sw_test_owoleaf_mock callbacks -> (none). The script prints:

t= 0.0s  closed    name enquiry -> 91  breaker now closed
t= 0.5s  closed    name enquiry -> 91  breaker now closed
t= 1.0s  closed    name enquiry -> 91  breaker now open
t= 1.5s  breaker open: failed fast, nothing sent to the switch
t= 2.0s  breaker open: failed fast, nothing sent to the switch
t= 2.5s  breaker open: failed fast, nothing sent to the switch
t= 3.0s  breaker open: failed fast, nothing sent to the switch
t= 3.5s  breaker open: failed fast, nothing sent to the switch
t= 4.0s  half-open name enquiry -> 91  breaker now open
t= 4.5s  breaker open: failed fast, nothing sent to the switch
t= 5.0s  breaker open: failed fast, nothing sent to the switch
t= 5.5s  breaker open: failed fast, nothing sent to the switch
t= 6.0s  -- B07 is back --
t= 6.0s  breaker open: failed fast, nothing sent to the switch
t= 6.5s  breaker open: failed fast, nothing sent to the switch
t= 7.0s  half-open name enquiry -> 00  breaker now closed
t= 7.5s  closed    name enquiry -> 00  breaker now closed
t= 8.0s  closed    name enquiry -> 00  breaker now closed
t= 8.5s  closed    name enquiry -> 00  breaker now closed
t= 9.0s  closed    name enquiry -> 00  breaker now closed
t= 9.5s  closed    name enquiry -> 00  breaker now closed
20 attempts: 10 reached the switch, 10 failed fast; 14 customers are waiting to retry
B07 was back at t=6.0s and the breaker noticed at t=7.0s: 1.0s of refusals after recovery
14 retries released at once: 14 requests in one tick
14 retries spread over 10 ticks: at most 3 requests in a tick, over 8 ticks

Three refusals open the breaker. Ten of the 20 attempts never reached the switch, and nothing was debited because every call was a name enquiry. The probe at 4.0 s fails, the breaker stays open, and the probe at 7.0 s succeeds, a second after B07 came back, which is the cost of a six-tick cool-down. The last two lines are the second wave: the 14 customers who were told to try again later come back together or spread out, and the spread puts at most 3 requests in a tick instead of 14. The spread comes from a seeded random number generator, so yours matches.

The thresholds in step 5 were chosen by looking at the answer. Generate another week and run the same detector on it:

python3 rails.py --seed 10 --out data/seed10
python3 work/detect.py data/seed10/rails.sqlite

You get:

refusals (91): 9; timeouts (97): 103; transfers: 18,014
rule A, 2 senders refused within 5 minutes: 1 alert(s)
   Wed 11:32:14  B07     real, 30.2 minutes after the start
rule A with 1 sender (any single refusal): 1 alert(s)
   Wed 11:12:10  B07     real, 10.2 minutes after the start
rule B, switch degraded: 1 alert(s)
   Thu 15:22:32  switch  real, 2.5 minutes after the start

Rule A now fires 30.2 minutes into the outage, because this week has 9 refusals and the first two from different senders within five minutes of each other come at 11:32. The single-refusal version is earlier, at 11:12, and would have been a false alarm in a network with background refusals. Rule B holds up here, 2.5 minutes in, and neither rule raised a false alarm on any seed from 1 to 10: the lab has no background refusals and few clumps of timeouts. Try seeds 3 to 9 and watch the bank rule’s delay move between 4 and 15 minutes. You will find the rule’s lateness depends on the week, and the thresholds are fitting weeks, not the failure. Write down what you would need from a real network to set the numbers honestly. When you finish, rm -r data/seed10 work.

ARTEFACT Write an outage runbook with its messages ~50 MIN
YOU PRODUCEOutage runbook with communications plan

Template

# Outage runbook: <participant or switch>, <failure type>
Owner · Approved by (operations) · Approved by (communications) · Date · Next review
Decision needed: <what the approvers are asked to agree>
Scope: <which links, which customers, which failures>

## Detect
| Signal | Threshold | Minutes to fire (lab or assumed) | Who is paged |
|---|---|---|---|
Own-side check before blaming the other side: <what to look at>
Triage: distinct receiving banks among the failures: one = <bank>, many = <switch>

## Route or hold
What we do: <fail fast, probe, breaker>
What we never do: <reverse on a timeout, resend, queue a debit>
Who may override: <role>

## Messages (one block per stage: first hour, update, recovery)
| Stage | Customers | Other banks | The switch | Next update |
|---|---|---|---|---|
Rules: pending, not failed; what happened to the money; no cause we do not have.

## Second wave
Expected retries: <count, spread, source>
Release plan: <rate, probe, who releases, stop condition>

## Reconcile
Scope: every transfer in doubt, whole week. Views compared: <switch, sender, receiver>
Breaks to look for: <list>. Owner, due date: <name, date>
Out of scope: <who recovers what, rules not confirmed>

## How this could be wrong
<One way, and what would show it>
WORKED EXAMPLE

Eloho leads B07’s operations team and writes this runbook. B07’s head of operations and head of communications approve it before it is used.

Decision needed: approve the thresholds and message stages below. Scope: B07’s link to the switch and the switch itself; not card or branch channels.

Detect. B07’s own link monitor and a probe of every participant, each minute. Customers are a poor alarm: in the lab’s week the first refusal came 5.6 minutes after 11:02 and the two-sender rule fired at 11:09:18, 7.3 minutes in. Also alert when outbound volume collapses: B07 sent 2 transfers in the window against a mean of 11.0. First check B07’s own link. Triage: one receiving bank means B07, many means the switch (Thursday’s 20 timeouts reached 13 banks).

Route or hold. No route reaches B07’s own accounts. Never reverse on a 97: 42 of the 101 timeouts (42%, ₦469,067) had reached the receiver. Enobong’s team decides whether the switch fails fast.

Messages. At 11:10 customers hear that transfers to other banks are unavailable, transfers inside B07 still work, and the next update is at 11:40. The switch gets the time the link dropped and no cause. After recovery, other banks hear that B07 is back from 11:49.

Second wave. Of 11 refused enquiries, 7 returned, 28 to 102 minutes later. Eloho’s team releases B07’s own queued retries gradually, behind a probe.

Reconcile. The whole week, not the window. B01 reversed its customer ₦18,200, yet B07 credited it and the final status is 97, so it never settles. B07 is out of pocket until recovered; the recovery rules are out of scope.

Wrong if: a real bank has background refusals, so one week is a weak guide to thresholds. A month of probe results would show the true refusal rate.

Now you

You are the operations lead at Ferrowave, the bulk payouts API with 210 business customers. Treat the lab’s week as the pattern for your own: B07 refuses all enquiries from 11:02 to 11:49 on Wednesday, and on Thursday from 15:20 to 15:34 the switch leaves 20 transfers unanswered (₦245,849 in all; 12 reached the receiver and settled, 7 were returned after a status query found no record, and 1 was credited but never settles). Assume that at 11:02 a payroll run of 4,000 payouts is queued and 600 are for B07 accounts; that is a stated assumption, not a lab figure.

Write Ferrowave’s outage runbook for payouts: which signals you watch (lab steps 2 and 5), what you hold and release (step 3), what each stage tells your business customers, B07 and the switch, and how your daily reconciliation file is used after recovery (step 6). The head of operations and the head of customer success approve it. It supports one decision: whether the 600 B07 payouts are held and released in waves, and what the business customers are told.

Self-check

DECIDE

At 11:02 B07 stops answering. Enobong's team runs the switch. Every name enquiry for a B07 account now waits out the full timeout before the sender is told anything, and senders' apps hang. Eloho at B07 says the link will be down for about an hour. What should the switch do while B07 is down?

READING
  1. DOC
    Regulation on Instant (Inter-Bank) Electronic Funds Transfer Services in Nigeria (CBN, 2018) Central Bank of Nigeria, 2018

    The regulator's text on what sending and receiving banks owe the customer and each other when a transfer fails. Read the duties of the sending and receiving entities and the sections on failed transactions, and check every deadline against the text, because the summaries this chapter saw disagree. Skip the definitions you know from module 1.

  2. DOC
    What are the services under NIP that customers can utilize? (NIBSS contact centre) NIBSS

    The operator's own help-centre list of what NIP does, including the transaction status query. Read it for the names NIBSS uses. It is a help article, not a specification: ask your sponsor bank or NIBSS for the participant documentation.

  3. DOC
    BCMS policy statement (NIBSS) NIBSS

    NIBSS's published statement of its business continuity commitments: aligned to ISO 22301:2019, with recovery strategies for time-critical activities. Read it for what it commits to, and note what it leaves out. The summary this chapter saw gave no recovery time targets, so read the full text.

  4. POST
    How CBN Revolutionized Payment Systems in Nigeria (ThisDay, 21 November 2022) ThisDay, 2022

    The 24-hour and 72-hour figures it gives for reversals and disputes, and the Industry Dispute Resolution System. It is an older press article and other sources give different figures, so use it to learn the process and the regulation to learn the deadlines.

  5. PAPER
    Principles for financial market infrastructures (CPMI and IOSCO, 2012) Committee on Payments and Market Infrastructures and IOSCO, 2012

    The international benchmark for payment and settlement systems. Read Principle 17 on operational risk and its notes on business continuity, which the summaries this chapter saw describe as a two-hour recovery objective. Skip the principles on credit and liquidity risk until the later chapter on clearing and settlement at the switch. Read: Principle 17, operational risk, and its explanatory notes.

  6. DOC
    Incident management guide (Google SRE) Google

    How a large engineering team splits an incident into roles: a commander, an operations lead who fixes, and a communications lead who tells. Read it for that split, which the runbook's communicate step needs. Skip the Google-specific tooling.

  7. POST
    NIBSS server down as Nigerian customers lament (Nairametrics, 10 February 2024) Nairametrics, 2024

    A press report of an outage as customers describe it: interbank transfers failing. Read it for the symptoms people name. It is press, not a postmortem, so take no cause or duration from it.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: AI on the rails: success-rate anomalies, mule scoring and the human controls →